I have an array named officeLocationsArray in officeLocation.ts file as follows.
export class OfficeLocation
{
officeLocationName:string;
Isopened:boolean;
}
export const officeLocationArray : OfficeLocation[] = [
{officeLocationName : 'India' , Isopened:false },
{officeLocationName : 'UK' , Isopened:false },
{officeLocationName : 'USA' , Isopened:false }
];
Now in my html I am doing an iteration of this officeLocationArray
<select class="form-control" name="officeLocation" id="officeLocation" formControlName="officeLocation">
<option *ngFor="let countryName of officeLocations" value="{{countryName.officeLocationName}}">{{countryName.officeLocationName}}</option>
</select>
Now I wanted to display the officeLocationNames based on the IsOpened property. When I apply ngIf it is popping an error that ngIf and ngFor cant be applied to single element in html .