directive: 目的是給DOM元素添加自定義行為,可以和Component class一樣,實作life cycle hooks:
css selector:
在template中唯一辨別一個Directive,并且觸發Directive執行個體的初始化。
看一個錯誤: 答案:you cant use input/output outside component / directive tag
正确做法?
in notification-message.component.html, it’s directly used in div tag
when I ctrl + click on line 3 above, it goes to line 12 in focus.directive.ts.
so it seems the name of selector and input are kept the same ON PURPOSE?
I think for small directives (single responsibility and single input) its simplified usage
————————————————
版權聲明:本文為CSDN部落客「汪子熙」的原創文章,遵循CC 4.0 BY-SA版權協定,轉載請附上原文出處連結及本聲明。
原文連結:
https://blog.csdn.net/i042416/article/details/113334525