I have a group of accounts like [{username: xxx, password: xxx} , ....], then I print them to page like below,
<tr ng-repeat = 'account in accounts'>
<td>{{account.username}}<td>
<td>{{account.password}}<td>
<td><button ng-click='ResetPassword(account)'>Reset</button></td>
</tr>
The ResetPassword() func,
$scope.ResetPassword = function(account){
$http.post('/reset/password/'+account.username).success(function(rAccount){
account = rAccount; //account & rAccount have the same structure.
}
});
};
The problem is if I override account=rAccount, the password UI never been updated, unless I set the attribute manually like account.password = rAccount.password, see this JSFIDDLE
So, why it doesn't work via obj overriding? then how to fix it? my account is far more complex than this example, it's not a good practice to update one by one I think, thanks.