javascript - get property values using ngcheck in angularjs -
javascript - get property values using ngcheck in angularjs -
in li
, user can select items, , each item has property of url, in end scheme store them.
in case couldn't ng-true-value because checkbox's ng-model has been occupied due other logics.
the demo http://plnkr.co/edit/p1fbw3swphnybqgbd6xj?p=preview
i want selected url , alert it.
you need prepare checkbox binding:
<input ng-show="showc || checked" type="checkbox" ng-model="checked">
should be:
<input ng-show="showc || checked" type="checkbox" ng-model="item.checked">
and checked items in getlinks
function:
$scope.getlinks = function(){ var urls = ''; angular.foreach($scope.lists, function(item){ if(item.checked === true){ urls += item.url + '\n'; } }); alert("selected links: " + urls); };
javascript angularjs
Comments
Post a Comment