如何在Angularjs中停止ng-model的双向数据绑定?

时间:2016-11-07 07:06:20

标签: javascript angularjs

如何在Angularjs中停止ng-model的双向数据绑定?

Reference Image added please click this link

1 个答案:

答案 0 :(得分:0)

下面的示例将为您提供一些时间绑定的理解,您可以使用::这样{{::scopeObject}}

来实现

var app = angular.module('app',[]);
app.controller('Ctrl',function($scope){
  
  $scope.name1 = 'Vikram';
  $scope.name2 = 'Angular';
  
  });
    <script data-require="angularjs@1.5.8" data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"></script>


<div ng-app="app" ng-controller="Ctrl">
  
  <input type="text" ng-model="name1" /> 
  {{::name1}} - One way binding
  
  <input type="text" ng-model="name2" /> 
  {{name2}} - Two way binding
  </div>