Why do I need to call detectChanges() with the default change detection strategy? Why do I need to call detectChanges() with the default change detection strategy? angular angular

Why do I need to call detectChanges() with the default change detection strategy?


I have solved the problem.

Another component sending notifications to this component was running Observable.fromEvent() outside the Angular zone, so change detection was not happening automatically in response to these events. This post on zones and this StackOverflow post on the issue held the solution!


You can Input your searchResults into the child Components

@Input() searchResults;

after that you pass it trough the parent template

// parent template<app-child [searchResults]="searchResults"></app-child>

you can use it in the child template

// child template <my-date-picker [ngModel]="searchResults"></my-date-picker>

after that you can 'listen' for changes in this property in the child Component

export class ChildComponent implements OnChanges {  @Input() searchResults;  constructor() { }  ngOnChanges() {    // some code  }

Every time searchResults is changed the changes will be populated in the child component, the values in the child template will get the new value.