Closed reflog closed 2 years ago
@reflog : Any updates on this issue.?
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:
tsconfig.json
file in node_modules/angular2-ui-switch/src
with the following content:{
"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"
]
}
ngc -p src
from node_modules/angular2-ui-switch
to recreate the content of the dist
folderThen it is possible to recompile the parent with both tsc
and ngc
(and ng-xi18n)
Can you confirm ?
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.
@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
?
@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
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
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
https://github.com/webcat12345/ngx-ui-switch
This support everything, and also pull request are welcome.
When compiling with 'ngc' the following error is reported: Error: Unexpected value 'UiSwitchModule' imported by the module '...'