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

Ivy - exportAs - failed to find #33628

Closed
kamilkisiela opened this issue Nov 6, 2019 · 3 comments
Closed

Ivy - exportAs - failed to find #33628

kamilkisiela opened this issue Nov 6, 2019 · 3 comments

Comments

@kamilkisiela
Copy link

Angular Compiler has some trouble with exportAs when Ivy is enabled.

I don't think there's more to add because the reproduction is done within 5 lines of code, everything is in the linked repository. I prepared GitHub Action as CI to show exactly when and where error happens.

🐞 bug report

Affected Package

Not sure but the issue might be caused by package @angular/compiler-cli

Is this a regression?

Yes, it works when Ivy is disabled.

Description

Ivy has problems with exportAs.

🔬 Minimal Reproduction

Very very minimal reproduction with CI: https://github.com/kamilkisiela/angular-ivy-exportAs-issue

<div bug #ref="bug">...</div>
@Directive({
  selector: 'bug',
  exportAs: 'bug',
})
export class BugDirective {}

🔥 Exception or Error

ERROR in Assertion error: failed to find directive with exportAs: bug

🌍 Your Environment

Angular Version:

Angular CLI: 9.0.0-rc.0
Node: 10.16.3
OS: darwin x64
Angular: 9.0.0-rc.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.0
@angular-devkit/build-angular     0.900.0-rc.0
@angular-devkit/build-optimizer   0.900.0-rc.0
@angular-devkit/build-webpack     0.900.0-rc.0
@angular-devkit/core              9.0.0-rc.0
@angular-devkit/schematics        9.0.0-rc.0
@ngtools/webpack                  9.0.0-rc.0
@schematics/angular               9.0.0-rc.0
@schematics/update                0.900.0-rc.0
rxjs                              6.5.3
typescript                        3.6.4
webpack                           4.41.2

Anything else relevant?

@alexzuza
Copy link
Contributor

alexzuza commented Nov 6, 2019

Shouldn't you use attribute selector in case of <div bug markup?

@Directive({
  selector: '[bug]', <------ like this
  exportAs: 'bug',
})

@JoostK
Copy link
Member

JoostK commented Nov 6, 2019

As @alexzuza mentions, the selector needs to be [dir] if used as <div bug>. I tested with your reproduction repo and cannot reproduce, unless I change [dir] to dir, in which case it does fail. The error has been cleaned up in #33454 which will be released with the next RC.

I'll go ahead and close this, but if you do still experience issues please mention it here or open a new issue. Thanks!

@JoostK JoostK closed this as completed Nov 6, 2019
@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 Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants