I want to change a value of an item inside an ng-repeat cycle using a dialog and then a function.
This for example won't work.
HTML
<div ng-controller="TodoListController as todoList">
<ul class="unstyled">
<li ng-repeat="todo in todoList.todos">
<label class="checkbox">
<span>{{todo.name}}</span>
<button ng-click="todoList.example(todo)">Click me</button>
</label>
</li>
</ul>
<div ng-if="todoList.show_box">
<button ng-click="todoList.change_me()">Now change me</button>
</div>
</div>
JS
angular.module('todoApp', [])
.controller('TodoListController', function() {
this.todos = [{
name: 'test 1'
}, {
name: 'test 2'
}];
this.example = function(v) {
this.tmp = v;
this.show_box = true;
};
this.change_me = function(v) {
this.tmp.v.name = 'now it\'s ok';
};
});
Full example