How to use @Input decerators in Angular

  angular, angular11, angular5, angular7, angular8

I’m confused when to use setter and getter method of @Inputs. If I’m having multiple inputs value how to handle it whether

@Input() sort;
@Input() pagination;
@Input() checkbox;


@Input set options(value: any) {
    sort: value.sort,
    pagination: value.pagination,
    checkbox: value.checkbox

using options as an object

@Input options:{
   sort: boolean,
   pagination: boolean, 
   checkbox: boolean
} = {
   sort: true,
   pagination: false, 
   checkbox: true

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.