One-time Binding in angularjs 1.3.0.-rc2
See original GitHub issueIf I use angular’s new one-time binding syntax on my translated values, shouldn’t the watch be removed after the translate value is defined?
I use something like <h3>{{::'FeaturedProducts' | translate}}</h3>
, but I still see a watch in Batarang.
I’m not sure if this is a bug in angular, angular-translate, or my misunderstanding of how the on-time binding should work, but this seems like a perfect scenario to use the one-time binding feature.
BTW, I’m using latest 2.4.0 of angular-translate
Issue Analytics
- State:
- Created 9 years ago
- Comments:19 (6 by maintainers)
Top Results From Across the Web
One-time binding with filter - angularjs
I'll migrate my angularjs application from 1.2.0 to 1.3.0-rc2 and I want to change my code from bindonce to the new one-time binding....
Read more >Developer Guide: Migrating from Previous Versions
Architecting your applications using components, multi-slot transclusion, one-way bindings in isolate scopes, using lifecycle hooks in directive controllers and ...
Read more >Notes about AngularJS Migrate from 1.2 to ~1.5 – The process
–One-time bindings syntax –ngAria -$http: add xhr statusText to completeRequest callback –ngMessages: introduce the NgMessages module and ...
Read more >AngularJS Notes for Professionals
Section 9.2: Dynamically load AngularJS service in vanilla JavaScript ... Section 20.5: Available binding through a simple sample ... 1.3.0-rc.2. 2014-09-17.
Read more >collection-repeat - Directive in module ionic
The scope of each item is assigned new data and re-digested as you scroll. Bindings need to update, and one-time bindings won't. Performance...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there any advantage to using this:
<span translate = "{{::'KEY'}}"></span>
. I assume that just the bit inside the double quotes"{{::'KEY'}}"
will be removed from the watcher (since it is an expression). This will resolve to just"KEY"
, and the directive itself will still be watching that attribute - Therefore for one to use a bind-once-and-forget approach, they would be limited to the filter only.Would this work
<h3>{{::value = ('FeaturedProducts' | translate)}}</h3>
? I haven’t tried thoughOr maybe an uglier version if it doesn’t cut it:
<h3 ng-init="value = ('FeaturedProducts' | translate)">{{::value}}</h3>