Why does Angular not need a dash in component name

前端 未结 2 1069
猫巷女王i
猫巷女王i 2021-01-01 18:31

I wondered why Polymer elements need a dash in custom elements name like while this is not necessary for Angular components especially as A

2条回答
  •  囚心锁ツ
    2021-01-01 18:47

    The HTML spec allows you to use unknown tags (, ) without the HTML parser throwing a fit. To their benefit, Angular uses this behavior for their directives to make the components like native.

    Tags that don't have a - inherit from HTMLUnknownElement. There's a good explanation of the upgrade process here: HTML5Rocks - Custom Elements - How elements are upgraded

    Since Angular directives were designed in a time before the Custom Elements spec existed, they don't use a -. It's the standard that requires element names contain a -.

提交回复
热议问题