Skip to content

Instantly share code, notes, and snippets.

@shhdharmen
Created August 27, 2021 16:04
Show Gist options
  • Save shhdharmen/c7e6f2394508e7f0d31920fad40f3165 to your computer and use it in GitHub Desktop.
Save shhdharmen/c7e6f2394508e7f0d31920fad40f3165 to your computer and use it in GitHub Desktop.
@Attribute() @Input()
Availability In constructor through dependency injection After component/directive initialization, in ngOnInit life-cycle hook
Type support string all
General usage HTML attribute DOM property or custom data
Code Snippets
<smart-input type="text"></smart-input> Works, value is text Works, value is text
<smart-input [type]="'text'"></smart-input> Doesn’t work, throws error NG8002 Works, value is text
<smart-input type="{{ 'text' }}"></smart-input> Doesn’t work, throws error NG8002 Works, value is text
<smart-input [attr.type]="'text'"></smart-input> Doesn’t work, value is null Doesn’t work, value is undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment