Vew not updating after scope update

Posted by bsparacino on Stack Overflow See other posts from Stack Overflow or by bsparacino
Published on 2013-10-28T01:01:52Z Indexed on 2013/10/29 3:54 UTC
Read the original article Hit count: 128

Filed under:

Here is a very simple example of what I am trying to do

Athlete.save(athlete,function(result)
{
       $scope.athlete = result.athlete;
});

The issue is that the $scope.athlete variable does not update in my view. In order to get it to update I have to do this

Athlete.save(athlete,function(result)
{
       $scope.athlete.fname = result.athlete.fname;
       $scope.athlete.lname= result.athlete.lname;
       $scope.athlete.gender= result.athlete.gender;
       ....
});

This gets annoying very quickly. With the first block of code it's as if angular does not know that my $scope.athlete variable has been updated. This function is triggered from an ng-click, not some jquery call, I am doing it the angular way as far as I know.

here is a simpler case I made: http://plnkr.co/edit/lMCPbzqDOoa5K4GXGhCp

© Stack Overflow or respective owner

Related posts about angularjs