AOT在角库中编译错误

问题描述:

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

我的代码,如果任何人有更多的经验,在这个问题上,请让我知道。我会感谢你的帮助。

感谢

您收到此代码中的工厂错误

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(视图, '值')));' –