Search code examples
angularjsangularangularjs-scopeangular6

What is $scope.$apply() equivalent in Angular 6?


We had $scope.$apply() in angularjs that perform proper scope life cycle of angularjs.

Is there any equivalent to this in Angular 6?


Solution

  • You are looking for ChangeDetectorRef

    Inject within your constructor

    constructor(private ref: ChangeDetectorRef) {
    }
    

    and call

    this.ref.detectChanges();