有问题使用ng-model获取数据

时间:2015-03-23 15:48:45

标签: javascript angularjs

<a on-swipe="onSwipe()" href="#/app/setting/{{book.id}}" ng-repeat="data in savedData">

我从localstorage获得了我的$ scope.savedData,如何让{{book.id}}知道用户实际想要删除的项目?

$scope.onSwipe = function () {
          //I need to get {{book.id}} here
};

将它绑定到新的ng模型?

1 个答案:

答案 0 :(得分:1)

将其作为参数传递:

<a on-swipe="onSwipe(book.id)" href="#/app/setting/{{book.id}}" ng-repeat="data in savedData">

$scope.onSwipe = function (id) {
      //id == book.id
};