I'm trying to find a way that allows me to save specific data from a array (or JSONP output).
Lets say I have this,
function Ctrl($scope) {
$scope.movies = [
{'title' : 'Star Wars', 'id' : '1'},
{'title' : 'Inception', 'id' : '2'},
{'title' : 'Inherent Vice', 'id' : '3'}
];
}
I display the results like this,
<div ng-controller="Ctrl">
<div ng-repeat="movie in movies">
{{ movie.id }} : {{ movie.title }} - <a href="#">Add Movie to watchlist</a>
</div>
</div>
When you click on add movie to watchlist I want to store that movie title and id in a scope so I can use it later. How could I do that?
Here is the plunkr example http://plnkr.co/edit/tycuNmJy71Yr4SUia2e5?p=preview