Angular 2 runs inside of its own special zone called NgZone and this special zone extends the basic functionality of a zone to facilitate change detection. It is Running inside a zone allows to detect when asynchronous tasks. If you change or update your internal application code or view and it is detecting the applications changes with help of NgZone. Example 1 - We use NgZone to trigger change detection as import { Component, NgZone} from '@angular/core' ; import { CommonModule } from '@angular/common' ; import { HttpModule, Http } from '@angular/http' ; import { UserService } from '../service/user.service' ; import { AppGlobals } from '../../shared/app.globals' ; @ Component({ selector : 'user' , templateUrl : './user.component.html' , styleUrls : [ './user.component.css' ], providers : [UserService, AppGlobals] }) export class UserComponent { //USERS DECLARATIONS. ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers