What is the Output decorator used for in this component class?

@Component({
    selector: ‘app-shopping-cart’,
    . . .
})
export class ShoppingCartComponent {
    @Output() itemTotalChanged = new EventEmitter();
}
  •  It makes the itemTotalChanged class field public.
  •  It provides a way to bind values to the itemTotalChanged class field, like so: <app-shopping-cart [itemTotalChanged]=”newTotal”></app-shopping-cart>.
  •  It provides a way to bind events to the itemTotalChanged class field, like so: <app-shopping-cart (itemTotalChanged)=”logNewTotal($event)”></app-shopping-cart>.
  •  It is simply a way to put a comment in front of a class field for documentation.

Leave a Reply

Your email address will not be published. Required fields are marked *