AngularJS: one-time binding syntax
See original GitHub issuePrettier 1.15.2 Playground link
--parser angular
Input:
<p>
{{ ::vm.user }}
</p>
Output:
SyntaxError: Unexpected token :
at o (https://prettier.io/lib/parser-angular.js:1:43175)
at t.parseNgInterpolation (https://prettier.io/lib/parser-angular.js:1:44299)
at n (https://prettier.io/lib/parser-angular.js:1:54796)
at Object.t.parseInterpolation (https://prettier.io/lib/parser-angular.js:1:55134)
at https://prettier.io/lib/parser-angular.js:1:55771
at Object.parse (https://prettier.io/lib/parser-angular.js:1:55427)
at Object.parse$2 [as parse] (https://prettier.io/lib/standalone.js:12931:19)
at textToDoc (https://prettier.io/lib/standalone.js:15724:23)
at https://prettier.io/lib/standalone.js:15712:14
at Object.embed$2 [as embed] (https://prettier.io/lib/standalone.js:20444:55)
Expected behavior:
No error.
Notice that AngularJS and Angular aren’t the same framework. The one with JS is an older incompatible version. However, their expression syntaxes seem to be mostly compatible except for this one-time binding thing. Docs: https://docs.angularjs.org/guide/expression#one-time-binding
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
AngularJS one-time binding syntax - Ultimate Courses
One-time binding is very simple, from the docs: One-time expressions will stop recalculating once they are stable, which happens after the first ...
Read more >angularjs - what is the difference between ng-bind vs one time ...
One-time binding is used for values that won't change after the page is stable. "Stable" generally means that the expression has been assigned...
Read more >AngularJS: Performance Optimization with One-time Bindings
At a high-level, one-time data binding means that the template is rendered once based on the current $scope and then it never updates....
Read more >AngularJS: Developer Guide: Expressions
The main purpose of one-time binding expression is to provide a way to create a binding that gets deregistered and frees up resources...
Read more >One TIME binding. Make your Angular.Js applications…
Always use “::” syntax in the templates to unless you need binding on the property. The effect can be seen by using a...
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 FreeTop 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
Top GitHub Comments
Note that syntax errors won’t be produced in child languages, this is a bug in our playground. Unknown syntax will be preserved if you’re using CLI.
Supporting a new syntax isn’t that simple, we need a parser for it (something like angular-estree-parser but for angular.js) since we don’t know what’s the difference between them, they look the same but we’re not sure, especially for edge cases.
And also I’m not sure if we should support angular.js, is it still developing not maintenance-only?
@icopp The syntax for filters/pipes is the same in AngularJS and Angular. Please prove me wrong if I am.
UPD yep, I was wrong, see #5586