angularjs - Ionic checkbox check whether the checkbox is checked or not -


i use ionic checkbox below html

   <ion-checkbox ng-repeat="ao in q.answeroptions"               name="cb" ng-click="setansweroptionselected(q.id,ao.id)">     {{ao.text}} </ion-checkbox> 

in controller need find out whether select check box checked or not . cannot use ng-model way finding out add property ao

isselected 

and use in check box.

ng-model="ao.isselected" 

can find out state of ionic checkbox whether checked or not in controller method in above code.

basically on call setansweroptionselected method should either able pass current ionic checkbox , check whether checked or not. ?

setansweroptionselected

i able find solution declaring dummy model on ng-init , passing value of variable parameter ng-click method.

<ion-checkbox ng-repeat="ao in q.answeroptions"               name="cb" ng-change="setansweroptionselected(qg.id,q.id,ao.id,checkstatus)"               ng-init='checkstatus=false'               ng-model="checkstatus">     {{ao.text}} </ion-checkbox> 

found solution post

how check if checkbox checked in angular


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -