单击列表中的变量

时间:2015-07-05 13:27:55

标签: javascript angularjs ionic-framework

我有离子/角度/ phonegap应用程序中的项目列表,我正在尝试使用操作表并传入变量。但是,ng-repeater处于启用状态,我似乎无法访问与ng-repeater在同一行上的变量。

标记:

<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>

后端:

$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为空

编辑 - 抱歉我太快了,{{}}修好了

1 个答案:

答案 0 :(得分:0)

我在发帖后三秒钟找到了自己的答案。它应该是ng-click =&#34; pet.AnimalCode&#34;不是{{}}