Given the following controller code
var NamesCtrl = function($scope) {
$scope.names = ['Bamse', 'Skalman'];
$scope.kill = function(name) {
$scope.names.splice(indexOf(name), 1);
}
};
Can I call the the kill function with the current name as parameter (I.e something like this)?
<div ng-repeat="name in names">
{{name}}
<input type="Button" ng-click="kill(name)" value="Kill"/>
</div>
$scope.names.splice($scope.names.indexOf(name), 1);