Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

data binding on checkbox angular

<input #saveUserNameCheckBox
    id="saveUserNameCheckBox" 
    type="checkbox" 
    [checked]="saveUsername" 
    (change)="onSaveUsernameChanged(saveUserNameCheckBox.checked)" />

//component.ts
public saveUsername:boolean;

public onSaveUsernameChanged(value:boolean){
    this.saveUsername = value;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #data #binding #checkbox #angular
ADD COMMENT
Topic
Name
1+4 =