SAP Spartacus directive学习笔记
生活随笔
收集整理的這篇文章主要介紹了
SAP Spartacus directive学习笔记
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
directive: 目的是給DOM元素添加自定義行為,可以和Component class一樣,實現(xiàn)life cycle hooks:
css selector:
在template中唯一標(biāo)識一個Directive,并且觸發(fā)Directive實例的初始化。
看一個錯誤:
Can’t bind to ‘cxFocusConfig’ since it isn’t a known property of ‘div’. ("
答案:
you cant use input/output outside component / directive tag
正確做法?
<div cxFocusDirective [cxFocusConfig]="Jerry">Hello</div>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
更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:
總結(jié)
以上是生活随笔為你收集整理的SAP Spartacus directive学习笔记的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 简介交换机常用的配置命令行_华为交换机命
- 下一篇: SAP Spartacus服务器端渲染模