Reputation: 2106
I am developing a NativeScript application. I want to use radiobutton functionality in my application.
I have tried to achieve this by using "nativescript-radiobutton" plugin, but it doesn't support in iOS.
Is there any solution through which it works for both Android and iOS platform?
Thank you in advance.
Upvotes: 1
Views: 2591
Reputation: 1101
Use this Html for the radio button -
<Label text="{{ checkYes ? '' : ''}}"
class="{{ checkYes ? 'fontawesome' : 'radioBefore'}}"
(tap)="changeAction()">
</Label>
Apply these two classes for Font Awesome -
.font-awesome {
font-family: "fontawesome-webfont";
font-size: 24;
}
.radioBefore {
font-family: "fontawesome-webfont";
font-size: 24;
}
Add Font-awesome.ttf file in fonts folder and then change the radio buttons selected or unselected with changeAction()
Function - Initialize
this.changeYes = true
changeGenderMale(){
if(this.changeYes == true)
this.changeYes = false;
else
this.changeYes = true;
}
Upvotes: 1