Bazinga
Bazinga

Reputation: 11214

angular 1.3 bind once doesn't work

I have this simple code and I don't know why when I'm typing in the input text it updates the two <h1> instead of only the second?

<h1>{{::person.name}}</h1>
<h1>{{person.name}}</h1>
<input type="text" ng-model="person.name"/>

Upvotes: 1

Views: 412

Answers (3)

daviddv
daviddv

Reputation: 177

It happened to us as well, AngularJS 1.3's bind-once does not work when Batarang extension is enabled. Disable Batarang and everything will be OK

Upvotes: 3

Kersh
Kersh

Reputation: 310

I had the same issue. Try to disable AngularJS Chrome extension. I disabled mine and bind once started to work.

Upvotes: 1

sylwester
sylwester

Reputation: 16498

Please make sure that you are using angular 1.3 version. Please see working sample below

var app = angular.module('app', []);

app.controller('homeCtrl', function($scope) {


  $scope.person = {
    name: "Jack"
  }

});
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>

<body>
  <div ng-app="app">
    <div ng-controller="homeCtrl">

      <h1>{{::person.name}}</h1>
      <h1>{{person.name}}</h1>
      <input type="text" ng-model="person.name" />
    </div>
  </div>
</body>

Upvotes: 1

Related Questions