Consequences of Custom HTML Tags in AngularJS Directives

后端 未结 2 661
轮回少年
轮回少年 2021-01-17 12:38

Say I wrote a custom gravatar directive in AngularJS that is bound to an email property on the scope. The directive would replace this HTML …

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-17 13:04

    While the initial source of the page body (before angular processes an ng-app element) may not adhere to the W3C standards, if you use "replace: true" in directives, custom elements are replaced by a template HTML, which can be valid. So, in this case, you can think about an angular element as just a placeholder that is replaced with the terminal HTML output.

提交回复
热议问题