I saw that @Attribute () is used in directives usually as a parameter in the constructor, like this:
export class EqualValidator implements Validator { constructor( @Attribute('validateEqual') public validateEqual: string) {} validate(c: AbstractControl): { [key: string]: any } {} }
and @Input () used in such components:
export class UserProfile { @Input() user; constructor() {} }
And then you can pass data to these variables in the template with property binding in the case of @Input ().
What are the main differences between these decorators and when should you use them?
angular
Alex
source share