Skip to content Skip to sidebar Skip to footer

Change A Value Inside Ng-repeat Cycle With Ng-click

I want to change a value of an item inside an ng-repeat cycle using a function. This for example won't work. HTML
  • Copy

    Demo Here

    Extended

    Also keep in mind while using this keyword inside a controller factory function. You should assign this variable to some variable to ensure that this which you are using is not other this, look at this context related issue.

    angular.module('todoApp', [])
      .controller('TodoListController', function() {
        var toList = this;
        toList.todos = [{name:'test 1'},{name:'test 2'}];
        toList.example = function(v) {
          v.name = 'ora bene';
        };
      });
    

Post a Comment for "Change A Value Inside Ng-repeat Cycle With Ng-click"