I am creating an simple TODO app using AngularJS, i POST the data to server 
when response comes, that response i want to store it existing variable and 
refresh the view. i.e

// This stores on page load, its working fine
var todos = $scope.todos = sever_passed_data;

but when i do,

$scope.$watch('todos', function () {
    var request = $http({
        method: "post",
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        url: my_url,
        data: $.param({todos_list: angular.toJson(todos)})
    });
    request.success(function(responce){
        var todos = $scope.todos = responce;
    });}, true);

after this it gives me weird(*it goes in infinite loop and posting data to 
server*) output, i mean the responce doesn't stores in todos variable.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to