Skip to content

Commit 4b20bb0

Browse files
committed
fix ngModel issue
1 parent 6601db8 commit 4b20bb0

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.2.2] - 2022-01-25
5+
### Bug Fixed
6+
- Fixed issue with ngModel input property
7+
48
## [0.2.1] - 2021-11-15
59
### Added
610
- Fixed issue setting default value when using Reactive Forms

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ng-toggle-button",
33
"description": "A toggle button component",
44
"author": "vicmans",
5-
"version": "0.2.1",
5+
"version": "0.2.2",
66
"homepage": "https://github.com/vicmans/ng-toggle-button#readme",
77
"repository": {
88
"type": "git",

projects/ng-toggle/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ng-toggle-button",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "Angular toggle button switch",
55
"author": "vicmans",
66
"license": "MIT",

projects/ng-toggle/src/lib/ng-toggle.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export class NgToggleComponent implements OnInit, ControlValueAccessor {
3939
@Input() uncheckedLabel: string = ''
4040
@Input() fontColor: string | toggleConfig
4141
@Input() values: valueConfig = {checked: true, unchecked: false}
42-
@Input('ngModel') model: boolean
4342
cssColors: boolean = false
4443

4544
@Output() change = new EventEmitter()
@@ -75,7 +74,7 @@ export class NgToggleComponent implements OnInit, ControlValueAccessor {
7574
}
7675

7776
setToogle() {
78-
const value = this.model !== undefined ? this.model : this.value
77+
const value = this.value
7978
let index = Object.values(this.values).findIndex(el => el == value)
8079
if(index > -1)
8180
this.toggled = Object.keys(this.values)[index] == 'checked' ? true : false

0 commit comments

Comments
 (0)