title: Get data on the Component load
body: <p>I have a component which needs to show the data in the grid on the component/page Load and when a button is clicked from parent component it needs refresh the grid with new data. My component is like below </p>
  
  <pre><code>export class TjlShipdateFilterComponent implements DoCheck {
  
    tljShipDate: ShipDateFilterModel[];
  
    constructor(private psService: ProjectShipmentService) {
    }
  
   ngDoCheck() {
   // this data is from the service, trying to get it on Page load
    }
  
  @Input() filter: ShipDateFilterModel[];
  //Load or refresh the data from parent when the button clicked from parent component 
  ngOnChanges(changes: SimpleChanges) {
  }
  </code></pre>
  
  <p>The ngOnChanges works fine, it gets the data from the parent component and displays when the button is clicked from the parent component. But on load of the page/component the grid it doesn't show anything and  says <code>this.psService.tDate;</code> is undefined.</p>
  
  <p>Below is the service where I get the <code>tDate</code></p>
  
  <pre><code>export class ProjectShipmentService {
     ......    
    constructor(service: DataService, private activatedRoute: ActivatedRoute) {
        service.get&lt;ShipDateFilterModel[]&gt;(this.entityUrl).subscribe(x =&gt; this.tDate = x);
     }
  </code></pre>
  
  <p>I am unsure what am I missing here. How can I achieve this scenario</p>