Skip to main content

Difference between template reference and template input variables?

Mid Angular
Quick Answer Template reference variable (#ref): references a DOM element or component instance in the template. lets you use nameInput.value. Template input variable (let-item): used inside structural directives to reference the current iteration value.
  • - item is a template input variable bound by the *ngFor directive's context.
  • Answer

    Template reference variables refer to DOM or component instances.
    Template input variables provide local directive context, such as ngFor.
    S
    SugharaIQ Editorial Team Verified Answer

    This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

    Want to bookmark, take notes, or join discussions?

    Sign in to access all features and personalize your learning experience.

    Sign In Create Account

    Source: SugharaIQ

    Ready to level up? Start Practice