Differences of using Component template vs templateUrl

前端 未结 6 1228
一整个雨季
一整个雨季 2020-12-14 08:22

Angular 2 allows to write multi-line templates by using ` characters to enquote them. It is also possible to put multi-line template into .html file and referen

6条回答
  •  死守一世寂寞
    2020-12-14 09:00

    Most of the answers seam to be around editor support, but, while that argument is true, I would not argue that as a strong point for putting the html and css into .html and .css files.

    The main reason that I separate my html and css files is because it follows SRP. It allows for easy code portability and reuse as Angular changes versions and syntax of how the typescript should be layed out, your html and css stay for the most part the same.

提交回复
热议问题