Angular2模板解析错误:属性绑定ng对于嵌入式模板上的任何指令都不使用

时间:2016-05-14 00:40:03

标签: angular polymer

这是Angular2模板:

<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>

我收到此错误:

"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"

国家/地区变量定义为:

public countries: Array<Country> = [];

我使用ngFor有什么问题?为什么要寻找ngForCountry?

2 个答案:

答案 0 :(得分:1)

var timer: dispatch_source_t! func startTimer() { let queue = dispatch_queue_create("com.domain.app.timer", nil) timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue) dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 60 * NSEC_PER_SEC, 1 * NSEC_PER_SEC) // every 60 seconds, with leeway of 1 second dispatch_source_set_event_handler(timer) { // do whatever you want here } dispatch_resume(timer) } func stopTimer() { dispatch_source_cancel(timer) timer = nil }

Just try might help

答案 1 :(得分:0)

您可以尝试: * ngFor =&#34; #country of countries&#34;