Having trouble setting up a user list in a material design popup? Getting an error that says, "Can't bind to 'ngForOf' since it isn't a known property of 'ion-list'?" After some digging, it seems like the issue stems from not importing { BrowserModule } from '@angular/platform-browser'; into the component's module. But, what if the component doesn't have an ngModule? How can you import { BrowserModule } for this component?
Here's the component:
import { Component, OnInit } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { AlertController } from '@ionic/angular';
import { GroupService } from '../services/groups/group.service';
import { AngularFirestore } from 'angularfire2/firestore';
@Component({
selector: 'app-search-dialog',
templateUrl: './search-dialog.component.html',
styleUrls: ['./search-dialog.component.scss'],
})
export class SearchDialogComponent implements OnInit {
sampleArr = [];
resultArr = [];
groupInfo: any;
constructor(public dialogRef: MatDialogRef<SearchDialogComponent>,
public afs: AngularFirestore,
private groupSvc: GroupService,
private alertController: AlertController) { }
ngOnInit() {}
search(event) {
// code goes here
}
onNoClick(): void {
this.dialogRef.close();
}
}
Experiencing issues with populating the list with data when searching in the bar? Even after adding an ngModule file to the search component folder? Here's the modified code snippet:
// Include necessary imports and components here
@NgModule({
imports: [
BrowserModule,
CommonModule,
FormsModule,
IonicModule,
MaterialModule,
],
declarations: [SearchDialogComponent],
entryComponents: [SearchDialogComponent],
exports: [SearchDialogComponent]
})
export class SearchDialogModule {}