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

fix(material/schematics): AsyncPipe and NgIF not imported #28055

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

fdonzello
Copy link
Contributor

@fdonzello fdonzello commented Nov 4, 2023

When running ng generate @angular/material:navigation navigation, the asyncPipe is used in the generated template but never imported into the Standalone Component imports.

While the AsyncPipe should be imported to fix the issue, the *ngIf is also used in the template (even though I think this disappears when the new control flow syntax adoption is finalized).
The fix proposes to import the CommonModule as we usually do when working with Standalone Components.

@@ -26,7 +27,8 @@ import { map, shareReplay } from 'rxjs/operators';
MatButtonModule,
MatSidenavModule,
MatListModule,
MatIconModule
MatIconModule,
CommonModule
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should import the AsyncPipe from @angular/common, rather than the CommonModule.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But also the NgIf is used.
Should we add it or just use the CommonModule as usual?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do NgIf since we don't need the entire module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code updated as discussed

@fdonzello fdonzello changed the title fix(material/schematics/navigation): asyncPipe not imported fix(material/schematics): asyncPipe not imported Nov 5, 2023
@fdonzello fdonzello changed the title fix(material/schematics): asyncPipe not imported fix(material/schematics): AsyncPipe and NgIF not imported Nov 6, 2023
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto self-assigned this Nov 6, 2023
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Nov 6, 2023
@crisbeto crisbeto merged commit 4fcf821 into angular:main Nov 6, 2023
crisbeto pushed a commit that referenced this pull request Nov 6, 2023
crisbeto pushed a commit that referenced this pull request Nov 6, 2023
@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, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants