"ionic ngfor in component" Code Answer's
You're definitely familiar with the best coding language Javascript that developers use to develop their projects and they get all their queries like "ionic ngfor in component" answered properly. Developers are finding an appropriate answer about ionic ngfor in component related to the Javascript coding language. By visiting this online portal developers get answers concerning Javascript codes question like ionic ngfor in component. Enter your desired code related query in the search bar and get every piece of information about Javascript code related question on ionic ngfor in component.
ionic ngfor in component
I'm going crazy, i've created a new component and he's working fine. Now i would like to use this on two pages.
Then i've created a component module (/components/all-components.module.ts) like this :
import { NgModule } from '@angular/core';
import { TagsComponent } from './tags/tags.component';
import { IonicModule } from '@ionic/angular';
@NgModule({
imports: [IonicModule],
declarations: [
TagsComponent
],
exports: [
TagsComponent
]
})
export class AllComponentsModule {}
I've added on app.module.ts the AllComponentsModule and on my 2 pages module i have added same.
Now, my component work fine when i'm displaying text or variable, my console.log return the data, but if i use *ngFor nothing appear.
Finally, here's my component
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-tags',
templateUrl: './tags.component.html',
styleUrls: ['./tags.component.scss'],
})
export class TagsComponent implements OnInit {
@Input() userTags: any;
constructor() {
}
ngOnInit() {
console.log(this.userTags);
}
}
And the view:
<p>hi</p>
<div *ngFor="let tag of userTags">
<p>{{tag?.name}}</p>
</div>
Ok i don't understand why but if i use a module to store all of components. On my all-components.module.ts i have to put the CommonModule to interpret *ngFor, *ngIf, etc.
With CommonModule import all working fine !
Here's the code updated:
import { NgModule } from '@angular/core';
import { TagsComponent } from './tags/tags.component';
import { CommonModule } from "@angular/common";
@NgModule({
imports: [CommonModule],
declarations: [
TagsComponent
],
exports: [
TagsComponent
]
})
export class AllComponentsModule {}
All those coders who are working on the Javascript based application and are stuck on ionic ngfor in component can get a collection of related answers to their query. Programmers need to enter their query on ionic ngfor in component related to Javascript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about ionic ngfor in component for the programmers working on Javascript code while coding their module. Coders are also allowed to rectify already present answers of ionic ngfor in component while working on the Javascript language code. Developers can add up suggestions if they deem fit any other answer relating to "ionic ngfor in component". Visit this developer's friendly online web community, CodeProZone, and get your queries like ionic ngfor in component resolved professionally and stay updated to the latest Javascript updates.