*directive not parsing correctly
See original GitHub issueSee example: http://plnkr.co/edit/9GdLbXM0mh5zHPKhcwCL?p=info
Both of these should parse correctly:
<div *bsPane="title exp"></div>
<div *bsPane="title: exp"></div>
Given:
@Directive({
selector: '[bsPane]'
})
class Foo {
@Input() bsPaneTitle: string;
}
instead get error:
Can't bind to 'bsPane' since it isn't a known native property ("
Demo:
<div [ERROR ->]*bsPane="title 'Overview'"></div>
<div *bsPane="title 'Summary'"></div>"): DiDemo@2:9
Property binding bsPane not used by any directive on an embedded template ("
Demo:
[ERROR ->]<div *bsPane="title 'Overview'"></div>
<div *bsPane="title 'Summary'"></div>"): DiDemo@2:4
Can't bind to 'bsPane' since it isn't a known native property ("
Demo:
<div *bsPane="title 'Overview'"></div>
<div [ERROR ->]*bsPane="title 'Summary'"></div>"): DiDemo@3:9
Property binding bsPane not used by any directive on an embedded template ("
Demo:
<div *bsPane="title 'Overview'"></div>
[ERROR ->]<div *bsPane="title 'Summary'"></div>"): DiDemo@3:4```
and
EXCEPTION: Template parse errors:
Parser Error: Unexpected token :, expected identifier, keyword, or string at column 13 in [bsPane title: 'Overview'] in DiDemo@2:9 ("
Demo:
<div [ERROR ->]*bsPane="title: 'Overview'"></div>
<div *bsPane="title: 'Summary'"></div>"): DiDemo@2:9
Parser Error: Unexpected token :, expected identifier, keyword, or string at column 13 in [bsPane title: 'Summary'] in DiDemo@3:9 ("
Demo:
<div *bsPane="title: 'Overview'"></div>
<div [ERROR ->]*bsPane="title: 'Summary'"></div>"): DiDemo@3:9
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
AngularJS: Directive not working properly - Stack Overflow
I find myself writing the same "search" UI on every module. So I've decided to write a directive, which I understand injects code...
Read more >0002266: Directive plugin_dir does not parsing correctly - MantisBT
Summary, 0002266: Directive plugin_dir does not parsing correctly ; Description, config common { plugin_dir = <?php echo $config['plugin_dir'] ?> } got an error...
Read more >Dockerfile reference - Docker Documentation
A single directive may only be used once. Once a comment, empty line or builder instruction has been processed, Docker no longer looks...
Read more >'using' Directives are Wrongly Shown as Unused
The used/unused filtering of Using Directives is not working correctly, i.e., using directives at the top are shown as unused with a distinct...
Read more >Structural directives - Angular
Note that Angular does not actually create a real <ng-template> element, ... The parser applies PascalCase to all directives and prefixes them with...
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
I’d like to expand on my previous comment.
There’s 2 separate issues here:
PR #12841 fixes (1) but prevents
<div *bsPane="title exp"></div>
; also fixes (2).Desugaring
Desugaring from * notation to
template
attribute is done before input string is tokenized. It prepends the attribute’s name followed by a space, then it tokenizes & parses. At this moment there’s no information about directives possibly being matched. I don’t see how it would properly add an “;” or “:” to it instead of a space at this step, with the goal of removing ambiguity in the grammar.Support for optional “:” everywhere
I propose this revised grammar:
Item 2.a.iii is there to remove ambiguity. If we permit any tuple, then I don’t see how it would be feasible to parse.
Some things to note / assumptions:
Valid input:
Invalid input:
@mhevery I’d like to know your thoughts about this. If you agree I can proceed with a PR.
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.