javascript - ng-click with variables in a list -
i have list of items in ionic/angular/phonegap application , i'm trying use action sheet , pass in variables. however, ng-repeater on , don't seem have access variable on same line ng-repeater.
markup:
<ion-view view-title="my pets"> <ion-content> <div class="list card"> <div class="item item-thumbnail-left item-icon-right" ng-repeat="pet in missing" ng-click="actionsheet({{pet.animalcode}})"> <img ng-src="http://*****.com/getimage.ashx?imgid={{pet.picture}}"> <h2>{{pet.name}}</h2> <p>{{pet.type}} - {{pet.subtype}} </p> <p>{{pet.size}} - {{pet.colour1}}</p> <i class="icon ion-chevron-right"></i> </div> </div> </ion-content> </ion-view>
backend:
$scope.actionsheet = function(petid) { $log.info(petid); var options = { title: 'manage pet', buttonlabels: ['edit pet', 'report lost', 'share pet'], addcancelbuttonwithlabel: 'cancel', androidenablecancelbutton: true, winphoneenablecancelbutton: true, adddestructivebuttonwithlabel: 'delete pet' }; $cordovaactionsheet.show(options) .then(function(btnindex) { var index = btnindex; });
petid empty
edit - sorry quick, taking {{}} fixed it
i found own answer 3 seconds after posting. should ng-click="pet.animalcode" not {{}}
Comments
Post a Comment