Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component type is lost due to input binding with expression #1278

Closed
akaufmann opened this issue Apr 12, 2021 · 1 comment
Closed

Component type is lost due to input binding with expression #1278

akaufmann opened this issue Apr 12, 2021 · 1 comment
Assignees
Labels
bug lib Relates to an issue in the @angular/language-service library

Comments

@akaufmann
Copy link

When you add an input binding with an expression the component is then of type HTMLElement instead of FooComponent.

bug

Additional context

Angular Language Server: 11.2.10
Angular CLI: 12.0.0-next.8
Node: 12.18.0
OS: darwin x64

Angular: 12.0.0-next.8
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package Version

@angular-devkit/architect 0.1200.0-next.8
@angular-devkit/build-angular 0.1200.0-next.8
@angular-devkit/core 12.0.0-next.8
@angular-devkit/schematics 12.0.0-next.8
@angular/cdk 12.0.0-next.6
@angular/fire 6.1.4
@angular/material 12.0.0-next.6
@nguniversal/builders 12.0.0-next.1
@nguniversal/express-engine 12.0.0-next.1
@schematics/angular 12.0.0-next.8
rxjs 6.6.6
typescript 4.2.3

@akaufmann akaufmann added the bug label Apr 12, 2021
@atscott atscott self-assigned this Apr 12, 2021
@atscott atscott added the lib Relates to an issue in the @angular/language-service library label Apr 12, 2021
atscott added a commit to atscott/angular that referenced this issue Apr 13, 2021
… matching

The language service uses an elements attributes to determine if it
matches a directive in the component scope. We do this by accumulating
all attribute bindings and matching against the selectors for the
available directives. When an attibute has a complex (non-literal
primitive) value, this code would previously generate an invalid
attribute such as `[attrName='1' + '2']`. For cases where the attribute
is bound to an expression that is not a literal primitive, this commit
changes the logic to only generate the attribute name and exclude the
value.

Fixes angular/vscode-ng-language-service#1278
atscott added a commit to atscott/angular that referenced this issue Apr 13, 2021
… matching

The language service uses an elements attributes to determine if it
matches a directive in the component scope. We do this by accumulating
all attribute bindings and matching against the selectors for the
available directives. When an attibute has a complex (non-literal
primitive) value, this code would previously generate an invalid
attribute such as `[attrName='1' + '2']`. For cases where the attribute
is bound to an expression that is not a literal primitive, this commit
changes the logic to only generate the attribute name and exclude the
value.

Fixes angular/vscode-ng-language-service#1278
atscott added a commit to atscott/angular that referenced this issue Apr 13, 2021
… matching

The language service uses an elements attributes to determine if it
matches a directive in the component scope. We do this by accumulating
all attribute bindings and matching against the selectors for the
available directives. When an attibute has a complex (non-literal
primitive) value, this code would previously generate an invalid
attribute such as `[attrName='1' + '2']`. For cases where the attribute
is bound to an expression that is not a literal primitive, this commit
changes the logic to only generate the attribute name and exclude the
value.

Fixes angular/vscode-ng-language-service#1278
atscott added a commit to atscott/angular that referenced this issue Apr 13, 2021
…tching

The language service uses an elements attributes to determine if it
matches a directive in the component scope. We do this by accumulating
all attribute bindings and matching against the selectors for the
available directives. The compiler itself does a similar thing. In
addition, the compiler does not use the value of `BoundAttribute`s to
match directives (https://github.com/angular/angular/blob/cdf1ea1951fb7187b1f6c9bb8a847c859c41e0b8/packages/compiler/src/render3/view/util.ts#L174-L206). This commit changes the language
service to also ignore bound attribute values for directive matching.

Fixes angular/vscode-ng-language-service#1278
zarend pushed a commit to angular/angular that referenced this issue Apr 14, 2021
…tching (#41597)

The language service uses an elements attributes to determine if it
matches a directive in the component scope. We do this by accumulating
all attribute bindings and matching against the selectors for the
available directives. The compiler itself does a similar thing. In
addition, the compiler does not use the value of `BoundAttribute`s to
match directives (https://github.com/angular/angular/blob/cdf1ea1951fb7187b1f6c9bb8a847c859c41e0b8/packages/compiler/src/render3/view/util.ts#L174-L206). This commit changes the language
service to also ignore bound attribute values for directive matching.

Fixes angular/vscode-ng-language-service#1278

PR Close #41597
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug lib Relates to an issue in the @angular/language-service library
Projects
None yet
Development

No branches or pull requests

2 participants