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

Cannot add ngProjectAs to host element as attribute #24058

Closed
dobrevad opened this issue May 22, 2018 · 2 comments
Closed

Cannot add ngProjectAs to host element as attribute #24058

dobrevad opened this issue May 22, 2018 · 2 comments
Labels
area: core Issues related to the framework runtime
Milestone

Comments

@dobrevad
Copy link

dobrevad commented May 22, 2018

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

I'm trying to use ngProjectAs by adding it to the host element but it doesn't work.

@Component({
  selector: 'my-form-error',
  template: `...`
  host: {
    '[attr.ngProjectAs]': 'projectAs',
  },
  providers: [{provide: MatError, useValue: MyFormError}],
})
export class MyFormError extends MatError {
  projectAs = "mat-error";
}

The following does but is not what I need:

    <my-error ngProjectAs="mat-error">
      my error message.
    </my-form-error>

Expected behavior

Expect to be able to add ngProjectAs to the host element since it's an attribute.

Is there anything wrong with doing that?

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Angular version: v6.0.2


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  < Mac, Linux>

Others:

@matsko matsko added the area: core Issues related to the framework runtime label May 22, 2018
@ngbot ngbot bot added this to the needsTriage milestone May 22, 2018
@dobrevad
Copy link
Author

Apparently that's by design since ngProjectAs is evaluated at compile time but is added dynamically to the host element. Resolving.

@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 Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime
Projects
None yet
Development

No branches or pull requests

2 participants