美文网首页
Conditionally bind Angular Event

Conditionally bind Angular Event

作者: forks1990 | 来源:发表于2018-09-24 11:25 被阅读0次

    Event

    <app-comp (click)="readOnly || foo()"></app-com>
    

    If readOnly then disables calling foo() method.

    Actually statement binds to @Output() angular property, not method or function.

    Property

    Like event binding, @Input() property bind to an expression, use a conditional express returns default property value like empty string, true/false/null etc.


    Note: angular statement not identical to typescript/javascript statement, compiled and transformed by angular compiler ngc.

    相关文章

      网友评论

          本文标题:Conditionally bind Angular Event

          本文链接:https://www.haomeiwen.com/subject/irvcoftx.html