Issue
I have simple 2 checkboxes
<input class="checkbox" [(ngModel)]="myRadio" type="radio" value="pin" name="autoriz">
<input class="checkbox" [(ngModel)]="myRadio1" type="radio" value="mnemonic" name="autoriz">
<button class="btn btn-unactive" (click)="goToMain()">
Continue
</button>
How i can check which of them is checked?
public goToMain() {
if(this.myRadio.target.checked){
alert(this.myRadio.getAttribute('value'));
}else if(this.myRadio1.target.checked){
alert(this.myRadio1.getAttribute('value'));
}
}
But i got an error that this.myRadio.target.checked not defined
Solution
try this:
Html:
<md-checkbox [(ngModel)]="radio1" name="radio1" id="radio1">Radio1</md-checkbox>
Ts:
if(this.radio1){
...
}
Answered By - Ivan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.