Skip to content

Define generic of ng-template #28731

Description

@waterplea

🚀 feature request

Relevant Package

This feature request is for @angular/language-service

Description

I quite often use ng-templates in my application to later include them in the *ngTemplateOutlet and pass them the context. However when I define the template itself, it doesn't know the interface the context will have, so say this:

<ng-template #willUseLater
             let-item
             let-index="index">
    {{index}} — {{item}}
</ng-template>

Gives me an error ng: The template context does not defined a member called 'index'. (note also a typo here)

Under ng-template there's TemplateRef<T>, but there is no way to define that T.

Describe the solution you'd like

Provide a way to define the generic in place without extra overhead

Describe alternatives you've considered

At least disable this error as it has no purpose if you have any complex template usage

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions