My question is about an example explained in the Angular Documentation about Angular template input variable.
https://angular.io/guide/template-syntax#expression-context
I tried to run this sample code and I am expecting the text entered in the input text box been displayed next to it. However, it doesn't work that way. I don't have this variable as viewChild inside the component as it is not mentioned in the Angular doc Page. Could you suggest here what is my mistake or my understanding is incorrect?
My sample code:
app.component.ts
import { Component } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'app-root',
template: `
<h1>{{title}}</h1>
<label>Type something:
<input #customerInput>{{customerInput.value}}
</label>
`,
styleUrls:["app.component.css"]
})
export class AppComponent {
testInput = "Hello"
title = 'Tour of Heroes';
recommended = true;
}
Output:
As I am a beginner with Angular, this may be a very basic mistake. However, I would use your feedback to learn and understand better. thank you.


