JavaScript Edu Resources. Angular Courses. React Tutorials. Join us!

Change Detection

  • By specifying changeDetectionStrategy.push at the component level we are able to limit change detection to only changes that directly affect the bindings in the component.
  • If an unrelated event occurs somewhere else in the application, the change detection algorithm is smart enough to bypass our component.
  • toString(); } }

    As you can see I have inherited the base and specified the change detection strategy at the component level like so:

    //Push Strategy import from ‘@angular/core’; import {BaseComment} from ‘.

  • /base-comment’; @Component({ selector:’comment-section-1′, }) export class CommentSection1 extends BaseComment{ constructor(){ super(); this.message = ‘Using } } //Default Strategy} import from ‘@angular/core’; import {BaseComment} from ‘.
  • However, the instance using default strategy will update during any change detection cycle – regardless of the origin of the event.



Change Detection in Angular


https://twitter.com/intent/tweet

Comments are closed, but trackbacks and pingbacks are open.