Hi.

What is the difference between ng-model="name"  and  
ng-model="name='blablabla'"?

first script works fine and I can change the input value but when I use 
second script then I cannot change.

have any idea related to this issue ?

1. 
<!DOCTYPE html>
<html>
<script src= 
"https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js";></script>
<script>
angular.module('app', [])
   .controller('test', ['$scope', function($scope) {
     $scope.name= 'blabla';
     $scope.write = function(data){
            $scope.name = data;
       };
   }]);
</script>
<body>

<div ng-app="app" >
  <div ng-controller="test">
   <input type="text" ng-keyup='write(name)' ng-model="name" >
   <p  ng-model="name">Name <b>{{name}} </b></p>
  </div>
</div>

</body>
</html>

-----------------------------------------------------------------------------------------

2.

<!DOCTYPE html>
<html>
<script src= 
"https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js";></script>
<script>
angular.module('app', [])
   .controller('test', ['$scope', function($scope) {
     $scope.name= 'blabla';
     $scope.write = function(data){
            $scope.name = data;
       };
   }]);
</script>
<body>

<div ng-app="app" >
  <div ng-controller="test">
   <input type="text" ng-keyup='write(name)' ng-model="name" >
   <p  ng-model="name='blablabla'">Name <b>{{name}} </b></p>
  </div>
</div>

</body>
</html>

-- 
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/d/optout.

Reply via email to