4

This is the Angular2 template:

<paper-dropdown-menu label="Country">
        <paper-listbox class="dropdown-content" [(ngModel)]="selectedCountry" (ngModelChange)="GetAdmin1s($event)">
            <paper-item *ngFor="let country of countries" value="{{country.Id}}">{{country.Name}}</paper-item>
        </paper-listbox>
    </paper-dropdown-menu>

I am getting this error:

"Template parse errors:
Property binding ngFor not used by any directive on an embedded template (""dropdown-content" [(ngModel)]="selectedCountry" (ngModelChange)="GetAdmin1s($event)">
            [ERROR ->]<paper-item *ngFor="let country of countries" value="{{country.Id}}">{{country.Name}}</paper-item>
 "): LocationComponent@4:12
Property binding ngForCountry not used by any directive on an embedded template (""dropdown-content" [(ngModel)]="selectedCountry" (ngModelChange)="GetAdmin1s($event)">
            [ERROR ->]<paper-item *ngFor="let country of countries" value="{{country.Id}}">{{country.Name}}</paper-item>
 "): LocationComponent@4:12"

Countries variable is defined as:

public countries: Array<Country> = [];

What is wrong with my use of ngFor? Why is it looking for ngForCountry?

Jonas Arcangel
  • 2,085
  • 11
  • 55
  • 85

2 Answers2

1

Just try might help

  <paper-dropdown-menu label="Country">
    <paper-listbox class="dropdown-content" [(ngModel)]="selectedCountry" (ngModelChange)="GetAdmin1s($event)">
        <paper-item ngFor #country [ngForOf]="countries" value="{{country.Id}}">{{country.Name}}</paper-item>
    </paper-listbox>
  </paper-dropdown-menu>
mayur
  • 3,558
  • 23
  • 37
0

You can try : *ngFor="#country of countries"