vicmans / ng-toggle-button Goto Github PK
View Code? Open in Web Editor NEWAngular toggle button switch
Home Page: https://ng-toggle-button.netlify.app/
License: MIT License
Angular toggle button switch
Home Page: https://ng-toggle-button.netlify.app/
License: MIT License
It would be nice if ng-toggle-button could be compatible with Angular Forms' required validator.
Hi there, Im seeing an error like #48 when trying to use this component on my app.
Error: node_modules/ng-toggle-button/lib/ng-toggle.component.d.ts:81:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.
81 static ɵcmp: i0.ɵɵComponentDeclaration<NgToggleComponent, "ng-toggle", never, { "value": "value"; "name": "name"; "disabled": "disabled"; "height": "height"; "width": "width"; "margin": "margin"; "fontSize": "fontSize"; "speed": "speed"; "color": "color"; "switchColor": "switchColor"; "labels": "labels"; "fontColor": "fontColor"; "values": "values"; "id": "id"; "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "ariaDescribedby": "aria-describedby"; }, { "change": "change"; "valueChange": "valueChange"; }, never, never, false, never>;
Im using:
"@angular/common": "^14.0.0",
"ng-toggle-button": "^1.4.1",
and node v18.16.0
.
I've also tried with "ng-toggle-button": "^1.5.1"
, but same error.
I've downloaded the repo and run the demo with no errors though. Not sure if Im using the right version of ng-toggle-button
for angular 14. Any help appreciated.
Thanks!
For accessibility purposes the toggle should be tabbable and triggerable with keyboard events.
Great package by the way!
Hi.
After module Import
Error: node_modules/ng-toggle-button/lib/ng-toggle.component.d.ts:75:18 - error TS2707:
ERROR: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.
It should be possible to focus the toggle using the Tab
key on the keyboard. The toggle should handle blur
events properly in relation to Angular form control's pristine and touched state. That is to say that if the toggle is focused using the keyboard and then unfocused, it should still be marked as touched even if the toggle value wasn't changed.
Programmatically updating the value of the value
input property does not update the toggle. I think this may be related to the fact that the onInput
method seems to be currently unused.
Accessibility tools raise an error to do with the input
label
Empty label text
Description:
The <label>
associated with the form control is empty.
<input type="checkbox" class="ng-toggle-switch-input" name="">
Issue description
Ensures every form element has a label
<input type="checkbox" class="ng-toggle-switch-input" name="">
To solve this violation, you need to...
Fix at least one (1) of these issues:
Hi,
to try and stay up-to-date with my dependencies, I use renovatebot like many.
Unfortunately ng-toggle-button does not provide a changelog file, so even tho I have unit and e2e tests, I need to check your source code changes before upgrading to a newer version, and if the changes seem important, I need to test manually.
A simple changelog would really help me in determining whether or not I should test a new version manually or I can just trust the tests.
Thank you for this project and for considering this suggestion!
Try it in your stackblitz, change the config.value to false.
Furtheron it should be possible to programmatically change the toggle button via the value property (not only for the initial state).
Found a small problem. ngModel doesn't work on angular v13.
Why is this even needed? why not make value a two way binding?
I tested this with the sample code locally. Can't share a stackblitz link because they don't support v13 yet.
The property and event halves of the two-way binding 'ngModel' are not bound to the same target.
Find more at https://angular.io/guide/two-way-binding#how-two-way-binding-works
35 <ng-toggle [(ngModel)]="config.value">
~~~~~~~
node_modules/ng-toggle-button/lib/ng-toggle.component.d.ts:4:22
4 export declare class NgToggleComponent implements OnInit, ControlValueAccessor {
~~~~~~~~~~~~~~~~~
The property half of the binding is to the 'NgToggleComponent' component.
node_modules/@angular/forms/forms.d.ts:3649:22
3649 export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
~~~~~~~
The event half of the binding is to the 'NgModel' component.
src/app/app.component.ts:28:16
28 templateUrl: './app.component.html',
~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component AppComponent.
This likely means that the library (ng-toggle-button) which declares NgToggleModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
Angular version:
`
Angular CLI: 9.1.15
Node: 14.17.3
OS: win32 x64
Angular: 9.1.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
@angular-devkit/architect 0.901.15
@angular-devkit/build-angular 0.901.15
@angular-devkit/build-optimizer 0.901.15
@angular-devkit/build-webpack 0.901.15
@angular-devkit/core 9.1.15
@angular-devkit/schematics 9.1.15
@angular/cli 9.1.15
@ngtools/webpack 9.1.15
@schematics/angular 9.1.15
@schematics/update 0.901.15
rxjs 6.6.6
typescript 3.8.3
webpack 4.42.0`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.