yuyang041060120 / angular2-ui-switch

angular2 ui switch component
http://yuyang041060120.github.io/angular2-ui-switch
MIT License
57 stars 36 forks source link

AOT mode is not supported #2

Closed reflog closed 2 years ago

reflog commented 8 years ago

When compiling with 'ngc' the following error is reported: Error: Unexpected value 'UiSwitchModule' imported by the module '...'

jinshad commented 7 years ago

@reflog : Any updates on this issue.?

carlgustavjung commented 7 years ago

Hello,

I faced the same issue and was able to use angular2-ui-switch with ngc : angular-cli: 1.0.0-beta.17 node: 6.7.0.

I followed what is described here : https://github.com/ceolter/ag-grid-ng2/issues/36 , which consists in recompiling the component with ngc in order to produce .metadata.json files

Here are the steps:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": true,
        "lib": ["es6", "dom"],
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false,
        "declaration": true,
        "outDir": "../dist",
        "stripInternal": true,
        "typeRoots": [
            "../@types"
        ]
    },
    "files": [
        "index.ts",
        "ui-switch.component.ts"
    ]
}

Then it is possible to recompile the parent with both tsc and ngc (and ng-xi18n)

Can you confirm ?

rmcsharry commented 7 years ago

When I try to run ng build I get the error: "UiSwitchModule is not an NgModule"

It seems the library is not fully compatible with latest AOT build process. More info at the end of this thread. See the post from @hansl.

bkbooth commented 7 years ago

@carlgustavjung your steps worked for me, but I don't want other people to have to do this too.

I'm not that familiar with ngc standards and best practices, but is there any reason why you haven't made those changes and created a pull request with the new tsconfig.json and metadata.json?

Eolan commented 7 years ago

@carlgustavjung Thank you, your post helped me a lot.

Yet am I the only one to have this error: [...]/node_modules/angular2-ui-switch/dist/ui-switch.component.ngfactory.ts:238:28: Supplied parameters do not match any signature of call target. ?

If I'm not wrong it has something to do with the getColor(flag) that should be something more like that getColor(flag?: string) I guess

daominhsangvn commented 7 years ago

Use this fork, i have added AoT fully supported. Just do $ npm install --save git+https://github.com/daominhsangvn/angular2-ui-switch

Hope this helps

bruno-barros commented 7 years ago

It's not working with Angular 4.

core.es5.js:1084 ERROR Error: Uncaught (in promise): Error: No value accessor for form control with unspecified name attribute
webcat12345 commented 7 years ago

https://github.com/webcat12345/ngx-ui-switch

This support everything, and also pull request are welcome.