2016-11-14 10 views
0

私はQuery/QueryListのためにこのドキュメントに従っているように感じますが、 "(SystemJS)デコレータは関数ではありません。デコレータは関数ではありません - 角度2

クエリとクエリリストを正しく定義していますか?

import { Directive, OnInit, OnDestroy, Input, Output, HostBinding, 
    EventEmitter, ElementRef, ContentChildren, ViewChildren, 
    Query, QueryList } from '@angular/core'; 
import { DropdownMenuInterface } from './dropdown.interface'; 
import { DropdownToggleInterface } from './dropdown.interface'; 
import { dropdownService, NONINPUT} from './dropdown.service'; 

@Directive({selector: '[dropdown]'}) 
export class Dropdown implements OnInit, OnDestroy { 

    ...... 

    // index of selected element 
    public selectedOption:number; 
    // drop menu html 
    public menuEl:ElementRef; 
    // drop down toggle element 
    public toggleEl:ElementRef; 

    dropdownMenuList: QueryList<ElementRef>; 

    constructor(public el:ElementRef, 
     @Query('dropdownMenu') dropdownMenuList: QueryList<ElementRef>) { 
    } 

    public set isOpen(value) { 
    this._isOpen = !!value; 

    ..... 

}両方Query

+0

私はこの問題はSystemJS構成ではなく、あなたのコードに関連していると信じています。 – rzelek

答えて

0

QueryListはデコレータではなく、タイプ(またはクラスとにかく)。

私は @ViewChildrenがそれに渡さ Queryに応じて更新されるように、私有財産を設定します(私は Queryはあなたが照会デコレータの1( @ViewChildren@ViewChild@ContentChild@ContentChildrenに送信する必要があるオブジェクトのタイプだと思うと思います

あなたが照会デコレータのChildren(ないChild)変種のいずれかを使用している場合)。

そしてQueryListは、プロパティのタイプである。

関連する問題