Closed FrancescoBorzi closed 6 years ago
Include the SCSS/CSS
I’ll yank the 6.1 releases and release 7.0 since this is an issue.
@cmckni3 I've tried that and still didn't work
Can you reproduce in stackblitz?
@cmckni3 sure, can you give me a template?
I use it with ReactiveForms and it looks like working here: https://stackblitz.com/edit/ngx-ui-switch-whhxxq
So I still don't know what in my codebase is causing the issue but, whatever it is, it's only affecting the newer release version.
I'll further investigate the issue, hoping to reproduce it in a separate environment.
@cmckni3 the issue is the following:
for some reasons if I include the style in a scss file using:
@import '~ngx-ui-switch/ui-switch.component.scss';
then it works. But if I include it in my angular.json
(and restart ng serve
) then it does not work (I've tried both css
and scss
files, same problems).
What does styles
for your application in angular.json
look like? This works for me.
{
"projects": {
"demo": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"styles": [
"src/styles.scss",
"./node_modules/ngx-ui-switch/ui-switch.component.css"
],
"scripts": []
},
...
}
...
}
}
@cmckni3 I've just realised that I was adding the style to a wrong style set. Everything works fine. Sorry for the confusion.
I've updated my project to use version
6.1.1
(previously I had6.0.3
) and all switches disappeared with no errors in the console.The
<ui-switch>
elements are still in the DOM but they have 0x0 dimensions.Reverting to version
6.0.3
solves the issue for me.