0 votes
in Angular by
What are What are property decorators in Angular?

1 Answer

0 votes
by

These are the second most popular types of decorators. They enable us to enhance some of the properties in our classes. We can certainly understand why we utilize any certain class property by using a property decorator.

There are many property decorators available for example @Input(), @Output, @ReadOnly(), @Override() 

Example: 

import { Component, Input } from '@angular/core';  
@Component({  
  selector: 'prop-component',  
  template: '<div> This is a test component ! </div>'  
})  
export class PropComponent {  
  @Input()  
  exampleProperty: string;  
}

The input binding would be sent via a component property binding:

<prop-component  
  [propProperty]="propData">  
</prop-component>
...