Angular 2 - Dynamic Variables in ngModel

前端 未结 5 2044
半阙折子戏
半阙折子戏 2020-12-31 06:58

How to use dynamic variables in ngModel?

I am trying to use the code below but the following error appears:

5条回答
  •  长发绾君心
    2020-12-31 07:58

    Let's say you have the following component

    export class AppComponent {
      qtd1 = 'qtd1';
      qtd2 = 'qtd2';
      qtd3 = 'qtd3';
    }
    

    Then your template might look like:

    Plunker Example

提交回复
热议问题