Skip to content

async lifecycle hooks - should angular support 'await ngOnInit' or other hooks #17420

@alex321

Description

@alex321

I'm submitting a ... (check one with "x")

[ X ] feature request

Hey, I would be interested whether it makes sense to support adding async in front of the Angular lifecycle hooks e.g.
async ngOnInit() { await ... }

I saw that being used recently and I immediately sounded an alarm as this would prevent the correct ordering of lifecycle hooks. IMHO I can see why the person used it but I am not sure that it makes sense for Angular to provide that.
Would it make sense to put any warnings in the docs? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions