I have a list of items in an ionic/angular/phonegap application and I'm trying to use an action sheet and pass in the variables. However, the ng-repeater is on an and I don't seem to have access to the variable on the same line as the 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 is empty
EDIT - Sorry i was too quick, taking the {{}} fixed it
I found my own answer three seconds after posting. It should be ng-click="pet.AnimalCode" not {{}}