You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(compiler): [property]="{{foo}}" should raise an exception #3645
Some users during a hack night were trying to set properties this way. Since {{foo}} would never be a valid expression, the compiler should raise a helpful exception when this pattern is found. Since this pattern is predictable, the exception should give specific feedback.
My suggestion: {{foo}} is not a valid expression in [prop]="{{foo}}". Try [prop]="foo"
So, today we are getting those errors for the <div [a]="{{b}}"> case:
Parser Error: Unexpected token {, expected identifier, keyword, or string at column 2 in [{{b}}] in someComponent
As for giving specific feedback: if we decide to go down this path we need to take all the binding forms (bind-a, data-bind-a) into account. Same goes for events ((click)="{{foo()}}") as well, I guess.
I'm also voting for more specific error messages here, if it's not to
expensive to implement. I think one thing that a lot of ppl struggled with
in AngularJS, was that the error messages weren't super clear at a first
glance (even tho I think minError is great). So if we can improve here, we
should definitely do so
On Sat, Aug 15, 2015, 11:26 AM Pawel Kozlowski [email protected]
wrote:
So, today we are getting those errors for the <div [a]="{{b}}"> case:
Parser Error: Unexpected token {, expected identifier, keyword, or string
at column 2 in [{{b}}] in someComponent
As for giving specific feedback: if we decide to go down this path we need
to take all the binding forms (bind-a, data-bind-a) into account. Same
goes for events ((click)="{{foo()}}") as well, I guess.
—
Reply to this email directly or view it on GitHub #3645 (comment).
I think this should be implemented in the parser, and the error should read: Got interpolation '{{}}' when expression was expected. This can easily be done in Parser to see if the parsing text (expression) starts with {{
Activity
pkozlowski-opensource commentedon Aug 15, 2015
So, today we are getting those errors for the
<div [a]="{{b}}">case:As for giving specific feedback: if we decide to go down this path we need to take all the binding forms (
bind-a,data-bind-a) into account. Same goes for events ((click)="{{foo()}}") as well, I guess.0x-r4bbit commentedon Aug 15, 2015
I'm also voting for more specific error messages here, if it's not to
expensive to implement. I think one thing that a lot of ppl struggled with
in AngularJS, was that the error messages weren't super clear at a first
glance (even tho I think minError is great). So if we can improve here, we
should definitely do so
On Sat, Aug 15, 2015, 11:26 AM Pawel Kozlowski [email protected]
wrote:
mhevery commentedon Aug 19, 2015
I think this should be implemented in the parser, and the error should read:
Got interpolation '{{}}' when expression was expected. This can easily be done in Parser to see if the parsing text (expression) starts with{{pkozlowski-opensource commentedon Aug 19, 2015
We should probably also check for interpolations inside an expression string to catch cases like
[foo]="before {{exp}} after"fix(parser): detect and report interpolation in expressions
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.