Angular Interview Questions and Answers Set 2
11. What is Traceur Compiler?
Traceur is a JavaScript compiler popularly used while developing code in AngularJS. It takes ECMAScript Edition 6 (ES6) which mainly includes classes, generators, destroying, etc. and then compiles to ECMAScript Edition 5 (ES5) which runs into the users’ browser.
12. Explain Life cycle in Angular?
In Angular, every component has a life-cycle, a number of different stages it goes through from initializing to destroying. There are 8 different stages in the component lifecycle. Every stage is called life cycle hook events.
13. Diff between functional hoisting and variable hoisting?
In addition to variables, hoisting applies to functions created using the function declaration syntax. Function declarations, as with the const variable, are defined and initialized in one step. However, functions are hoisted by moving the entire function, not just the declaration, to the top of the scope.
14. What are the basic rules of Decorators?
The decorator allows us to define this intent without having to actually put any code inside the class.
15. What is the difference between $scope and scope?
In dependency injection,inject the scope object with the $ prefix. The injected arguments must match the names of inject-able objects followed by $ prefix.If directive linker functions don’t receive arguments through dependency injection, pass the scope object without using $ prefix.
ANGULAR TRAINING
Weekend / Weekday Batch
16.What is ngContent?
The ng-content tag is used for content projection. It is basically a placeholder to hold the dynamic content until it is parsed. Once the template is parsed, Angular replaces the tag with content.
17. What is dependency injection (DI) in Angular?
Dependency injection, or DI, is a design pattern in which a class requests dependencies from external sources rather than creating them. Angular’s DI framework provides dependencies to a class upon instantiation.
18.What is the use of ngFor directive in Angular?
The *ngFor directive is used to repeat a portion of HTML template once per each item from an iterable list (Collection). The ngFor is an Angular structural directive and is similar to ngRepeat in AngularJS.
19. What is SSE?
Server-Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server via HTTP connection. The Server-Sent Events EventSource API is standardized as part of HTML5 by the W3C.
20. What are template expressions in Angular?
A template expression produces a value and appears within double curly braces, {{ }} . Angular resolves the expression and assigns it to a property of a binding target. The target could be an HTML element, a component, or a directive.