Angular2 add HTML to dynamic elements

后端 未结 2 1967
暖寄归人
暖寄归人 2020-12-10 13:23

I have this code:

import { Component, ElementRef, Renderer2 } from \'@angular/core\';

@Component({
    selector: \'my-app\',
    template: \'
2条回答
  •  醉酒成梦
    2020-12-10 13:50

    you can use ngfor and create you elements inside it and using index you can create different ids and names. I do something like this i dont know if you want to do the same but here's my code to create some input's dynamically and add or access their values

    {{comp.data}}

提交回复
热议问题