Jobsdev
Jobsdev

Reputation: 1039

I'm getting error in interpolation of data

The following code does not work. I've tried everything to make it work. It appears that angle 2 does not accept interpolation calling a direct variable.

@Component({
  template: ` <input type="text" name="name" [(ngModel)]="name" #name="ngModel">
              {{ name }}
            `
})
export class ProductComponent {

    private name:string = '';
}

rather than 'name' I would have to use product.name.

that's right? but why?

Upvotes: 0

Views: 33

Answers (1)

yurzui
yurzui

Reputation: 214017

You have a conflict of variables

Replace #name="ngModel" with #name2="ngModel"

Upvotes: 2

Related Questions