Elton Jamie
Elton Jamie

Reputation: 584

Having issue getting data using ng-model

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

I got my $scope.savedData from localstorage, how can I get {{book.id}} to know which item the user actually want to delete?

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

bind it to a new ng-model?

Upvotes: 0

Views: 26

Answers (1)

tymeJV
tymeJV

Reputation: 104795

Pass it as a parameter:

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

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

Upvotes: 1

Related Questions