Reputation: 143
<div ng-repeat="tack in feed">
<div class="pin" ng-if="selected == tack.boards">
<a href="{{ tack.link }}"><h3>{{ tack.title }}</h3></a>
<img src="{{ tack.imageURL || 'http://www.designofsignage.com/application/symbol/building/image/600x600/no-photo.jpg' }}" />
<p>
{{ tack.desc }}
</p>
<br>
<p>
<button ng-click="deleteTack(tack.link)" class="btn btn-danger">Delete</button>
</p>
</div>
</div>
I am trying to pass a value in a function written in my controller. But the value is not getting passed to the controller.
A string on other arguments is getting passed except for tack.link
or any other value fetched from ng-repeat
label.
Upvotes: 1
Views: 111
Reputation: 20741
Its Working Fine!!!
Take a look at this
html
<div ng-app='myApp' ng-controller="Controller">
<div ng-repeat="tack in feed">
<div class="pin" ng-if="selected == tack.boards"> <a href="{{ tack.link }}"><h3>{{ tack.title }}</h3></a>
<img src="{{ tack.imageURL || 'http://www.designofsignage.com/application/symbol/building/image/600x600/no-photo.jpg' }}" style="width:100px;height:100px;" />
<p>{{ tack.desc }}</p>
<br>
<p>
<button ng-click="deleteTack(tack.link)" class="btn btn-danger">Delete</button>
</p>
</div>
</div>
</div>
script
var app = angular.module('myApp', []);
app.controller('Controller', function ($scope) {
$scope.feed = [{
boards: 'selected',
link: 'link_1',
title: 'title_1',
desc:'desc_1'
}, {
boards: 'selected',
link: 'link_2',
title: 'title_2',
desc:'desc_2'
}, {
boards: 'selected',
link: 'link_3',
title: 'title_3' ,
desc:'desc_3'
}, {
boards: 'selected',
link: 'link_6',
title: 'title_6',
desc:'desc_6'
}, {
boards: 'selected',
link: 'link_4',
title: 'title_4',
desc:'desc_4'
}, {
boards: 'selected',
link: 'link_5',
title: 'title_5',
desc:'desc_5'
}];
$scope.deleteTack = function(link)
{
alert(link);
}
});
Upvotes: 1