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.











网友评论