1. What is entrycomponents in angular ngmodule ?

This is for dynamically added components that are added using ViewContainerRef.createComponent(). Adding them to entryComponents tells the offline template compiler to compile them and create factories for them.

The components registered in route configurations are added automatically to entryComponents as well because router-outlet also uses ViewContainerRef.createComponent() to add routed components to the DOM.

Offline template compiler (OTC) only builds components that are actually used. If components aren’t used in templates directly the OTC can’t know whether they need to be compiled. With entryComponents you can tell the OTC to also compile this components so they are available at runtime.

More: https://stackoverflow.com/questions/39756192/what-is-entrycomponents-in-angular-ngmodule

2.  What is an entry component? 

NgModule docs (angular.io)

Defines the components that should be compiled as well when this component is defined. For each components listed here, Angular will create a ComponentFactory and store it in the ComponentFactoryResolver.

If you don’t list a dynamically added component to entryComponents you’ll get an error message a bout a missing factory because Angular won’t have created one.

See also https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html

3.What is the proper lifecycle hooks for the application development in Angular 5?

Angular provides verities lifecycle hooks (similar to the specific event) which help the application to execute any specific activity on event wise. Normally all the interfaces available in Angular have at least one single hook method which should start with ng, as for example, ngOnInt interface, for the same component should need to maintain or implemented OnIntit method.

  • ngOnChanges
  • ngOnInit
  • ngDoCheck
  • ngOnDestroy
  • ngAfterContentInit
  • ngAfterContentChecked
  • ngAfterViewInit
  • ngAfterViewChecked

 

4.Explain the difference between JIT Compiler and AOT Compiler?

JIT (Just in Time):

  • An application is normally compiled at runtime in the browser.
  • It normally compiles application just before running not before that.
  • All the files are separately compiled in case of JIT.
  • If a developer change any logic in code, recompilation, and redeployment is not require, JIT will automatically compile those components in the browser at runtime and effect the changes at the time of display the same.
  • It always ensuring application security part by given high preference.
  • At the time of developing the application, JIT is very helpful, so it will always be preferable for running the application in the local environment.

AOT (Ahead of time):

  • It ensures the application code should compile at the time of building. No runtime or browser specific dependency for the same.
  • It compiles the code at runtime as well.
  • For avoiding browser dependency, it can compile by command line faster on the developer system itself.
  • All the written code normally compiled together, HTML CSS code is maintained separately.
  • It also maintained a security part by given high preference.
  • It is a secure and wonderful environment for the production build, as we can avoid runtime compilation, in production which is little risky.

5. Define core differences for Observables and Promises?

Promises:

  • It always returns a single value.
  • Not possible to cancel.

Observables:

  • Working with multiple values as per requirement.
  • Always can be canceled.
  • Support collection operators like Map, Filter.
  • Following features of ES 2016.
  • Using RX JS.

6. Define exact differences between Constructors and OnInit?

Constructors:

  • It is always called as default when constructing a component.

OnInit:

  • ngOnInit call after the constructor and first ngOnChanges.

7. Event emitters?

Event Emitter is one the class using to emit custom events.

@output() somethingchanged = new EventEmitter();

8. @Input and @Output in Angular 5 ?

9. Differences between components and Directives in  Angular 5?

10. Differences between Activated Route and Router Route in Angular 5?

11. Define the ng-content Directive?

12.Demonstrate navigating between different routes in an Angular application.

13.Services in Angular?

Singleton objects in Angular that get instantiated only once during the lifetime of an application are called services. An Angular service contains methods that maintain the data throughout the life of an application.

The primary intent of an Angular service is to organize as well as share business logic, models, or data and functions with various components of an Angular application.

The functions offered by an Angular service can be invoked from any Angular component, such as a controller or directive.