Search code examples
angularangular-cliangular-compiler-cli

AOT Compilation error in angular library


I Made a library for Angular 2 but I am stuck in this issue.

I am getting this error:

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

and I don't understand what it's wrong in my code.

you can review my code on Github here

If anyone have more experience in this issue please let me know. I will appreciate your help.

Thanks


Solution

  • You are getting error in factory within this code

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

    It means that you have output property with name value

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

    but in the same time i see:

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

    So i would remove

    outputs: ['value'],