Reputation: 399
I am new in ionic framework.I am create one user profile and pass user input's through api url (yii2 api) . For example normal text field
<input name="location" ng-model="data.location" type="text" placeholder="location" ng-required="true">
my api url like this
return $http.get('http://localhost/web/index.php?r=apiprofile/new&user_id='+$scope.data.user_id+'&location='+$scope.data.location)
This is working fine and the location value stored database correctly.But i use multiple checkbox means how to pass this url.
<ion-checkbox ng-model="data.jobtype1" ng-true-value="'parttime'">parttime</ion-checkbox>
<ion-checkbox ng-model="data.jobtype2" ng-true-value="'fulltime'">fulltime</ion-checkbox>
<ion-checkbox ng-model="data.jobtype3" ng-true-value="'contract'">contract</ion-checkbox>
I want user clicks three checkbox means look like this in database [parttime,fulltime,contract] that is same as in php multiple checkboxes.
I am already try same ng-model name for three checkbox ,but it is not working properly,when i click any one checkbox means all three checkbox is clicked and the database value is "undefined". And i passing like below url means the value in database like this [parttimefulltimecontract]
return $http.get('http://localhost/web/index.php?r=apiprofile/new&user_id='+$scope.data.user_id+'&jobtype='+$scope.data.jobtype1+$scope.data.jobtype2+$scope.data.jobtype3)
Please help any one
Upvotes: 0
Views: 475
Reputation: 3350
<ion-checkbox ng-model="jobtype1" ng-true-value="parttime" ng-false-value="0" ng-checked="jobtype1== parttime" />
Try this.
http://codepen.io/ionic/pen/hqcju
Upvotes: 0