If you just need to "see" that the value is updating on the $scope, use an
ng-click on a button to call a function and console.log() the value after
you've changed it in the view.
<div ng-controller="myCtrl">
<input ng-model="item.text">
<button ng-click="logText">Log it</button>
</div>
function myCtrl(){
$scope.item = { text: '' }
$scope.logText = function(){
console.log($scope.item.text)
}
}
On Monday, February 24, 2014 2:43:46 PM UTC-7, Ron Likvornik wrote:
>
> Someone told me that in Angular when i update something in the model the
> view should be updated automatically. And when i update something in the
> view the model should be updated automatically.
> I can see why the view updated automatically when i change the model but i
> cannot see the opposite.
> Can you give me an example for that?Thanks.
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.