2017-05-14 80 views
0

我爲Angular 2製作了一個庫,但是我卡在this issue中。AOT在角庫中編譯錯誤

我收到此錯誤:

ERROR in C:/xampp/htdocs/github/jw-bootstrap-switch-ng2/switch-project/src/$$_gendir/node_modules/jw-bootstrap-switch-ng2/src/directive.ngfactory.ts (246,59): Property 'subscribe' does not exist on type 'boolean'. 

,我不明白什麼是錯在我的代碼。

您可以查看在Github上here

我的代碼,如果任何人有更多的經驗,在這個問題上,請讓我知道。我會感謝你的幫助。

感謝

回答

1

您收到此代碼中的工廠錯誤

this.context.value.subscribe(_eventHandler.bind(view,'value'))); 

這意味着你必須output屬性名稱爲value

@Component({ 
    selector: 'bSwitch', 
    outputs: ['value'], 

但在同一時間,我看到:

get value(): boolean { 
    return this._innerState; 
}; 

set value(v: boolean) { 
    if (v === null || typeof v === "undefined") this._indeterminate = true; 
    this.setStateValue(v); 
} 

所以我會刪除

outputs: ['value'], 
+0

感謝@yurzui,但你在哪裏找到這個'this.context.value.subscribe(_eventHandler.bind(視圖, '值')));' –