Error while adding “for” attribute to label in angular 2.0 template

后端 未结 1 1707
悲哀的现实
悲哀的现实 2021-01-04 00:20

I use the Angular 2.0 framework and try to create an input component. Also I use Google MDL and it\'s HTML structure required to have labels to input. Angular gives me an e

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-04 00:44

    update

    In recent Angular2 versions for should be mapped to htmlFor automatically to avoid this kind of problem.

    original

    You need attribute binding instead of proper binding

    
    

    or

     
    

    or

    
    

    htmlFor is the property that reflects the for attribute (https://developer.mozilla.org/de/docs/Web/API/HTMLLabelElement)

    See also HTML - attributes vs properties

    0 讨论(0)
提交回复
热议问题