Component lifecycle in ionic

Hello, I have built a component as follows


export class AcknowledgementComponent implements AfterViewInit {

  private description: string;

  @Input('period') period: string;
  constructor() {
  }

  ngAfterViewInit() {
    console.log(this.period)
  }

I have to perform some logic with that variable before using it in the template. But in ngOnInit and ngAfterViewInit, the variable is undefined. Can someone advise which hook to use in order to get the variable?

ngOnChanges() is the only reliable place to reference input properties.

1 Like

Hello. Thanks for the reply. Does not get neither the current or previous value though.

Ashley.