question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

One-time Binding in angularjs 1.3.0.-rc2

See original GitHub issue

If 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:closed
  • Created 9 years ago
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lopesccommented, Oct 18, 2016

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.

1reaction
mebiboucommented, Jun 24, 2016

Would this work <h3>{{::value = ('FeaturedProducts' | translate)}}</h3>? I haven’t tried though

Or maybe an uglier version if it doesn’t cut it: <h3 ng-init="value = ('FeaturedProducts' | translate)">{{::value}}</h3>

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found