This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Do You Understand By Services With Reference To Angular Js? |
|
Answer» Services in angular JS are used to organize and share CODE across your application. These are the suitable objects which are WIRED together with the help of dependency injection. The angular js services are lazily instantiated. The service is only instantiated by angular js only when the application COMPONENT depends on it. In angular js, NEW services can be made or can even be used in other built-in services. Over 30 built-in services are present in angular js. Services in angular js are used to organize and share code across your application. These are the suitable objects which are wired together with the help of dependency injection. The angular js services are lazily instantiated. The service is only instantiated by angular js only when the application component depends on it. In angular js, new services can be made or can even be used in other built-in services. Over 30 built-in services are present in angular js. |
|
| 2. |
What Is A Routing In Angular Js? |
|
Answer» NgRoute module is used when you want to navigate through different PAGES of your application but you also want your application to be a single page application. This ngRoute module NAVIGATES through different pages of your application without reloading the entire application. The angular js route module should be included to make your application ready for routing. The ngRoute is ADDED as a dependency in the application. The routing engine captures the specific URL requested by the user and renders the view based on the defined routing RULES. NgRoute module is used when you want to navigate through different pages of your application but you also want your application to be a single page application. This ngRoute module navigates through different pages of your application without reloading the entire application. The angular js route module should be included to make your application ready for routing. The ngRoute is added as a dependency in the application. The routing engine captures the specific url requested by the user and renders the view based on the defined routing rules. |
|
| 3. |
What Do You Understand By Isolated Unit Tests? |
|
Answer» As the name implies, unit test is all about testing individual units of code. In ORDER to answer some questions, isolating the unit of code under test is really important. When we do this, we are not forced into CREATING related pieces such as DOM ELEMENTS for sorting. With the help of isolated unit tests, it becomes easier to IMPLEMENT everything. To simulate the requests, dependency injections are ALSO provided. The individual sort function can be tested in isolation. And not only the sort function, any function can be tested in isolation. As the name implies, unit test is all about testing individual units of code. In order to answer some questions, isolating the unit of code under test is really important. When we do this, we are not forced into creating related pieces such as DOM elements for sorting. With the help of isolated unit tests, it becomes easier to implement everything. To simulate the requests, dependency injections are also provided. The individual sort function can be tested in isolation. And not only the sort function, any function can be tested in isolation. |
|
| 4. |
Write The Difference Between Directive And Component In Angular Js? |
|
Answer» In angular js, there are DIFFERENCES between the meta-data annotations. Some of the differences are:
In angular js, there are differences between the meta-data annotations. Some of the differences are: |
|
| 5. |
Explain Ngif Directive ? |
|
Answer» The NGIF is a built-in template directive which is used to add or remove some parts of DOM. This addition or removal depends on the EXPRESSION being true or false. If the expression is evaluated to false, then the ngIf directive REMOVES the HTML element. If the expression is evaluated to be true, then the element gets ADDED to the DOM. Syntax:- *ngIf=”<condition>” The ngIf is a built-in template directive which is used to add or remove some parts of DOM. This addition or removal depends on the expression being true or false. If the expression is evaluated to false, then the ngIf directive removes the HTML element. If the expression is evaluated to be true, then the element gets added to the DOM. Syntax:- *ngIf=”<condition>” |
|
| 6. |
Explain Property Binding Or One Way Binding In Angular Js? |
|
Answer» BASICALLY PROPERTY binding means passing data from the component class and setting the value of a given element in the view. It is a one WAY binding in which the data is passed from component to the class. It allows us to control the element property values from component to class. Property binding in angular can TAKE place by three ways: Interpolation can be used to define a value, as long as the value being defined is a STRING. Wrapping brackets around the element property and binding it to the component property is the most common type of property binding. The third way is by adding “bind” before the element property. Basically property binding means passing data from the component class and setting the value of a given element in the view. It is a one way binding in which the data is passed from component to the class. It allows us to control the element property values from component to class. Property binding in angular can take place by three ways: Interpolation can be used to define a value, as long as the value being defined is a string. Wrapping brackets around the element property and binding it to the component property is the most common type of property binding. The third way is by adding “bind” before the element property. |
|
| 7. |
Explain Ngfor Directive With An Example? |
|
Answer» The ngFor DIRECTIVE instantiates a TEMPLATE for EVERY element of the given iterator. The different local variables of the ngFor directive can be used in iterations. The ngFor directive can even be used with the HTML elements. It ALSO performs various changes in DOM. Several exported values can be aliased to local variables with the help of ngFor directive. It allows us to build data presentation lists and tables in our HTML TEMPLATES. Here’s an example of ngFor directive with the help of HTML: <tr *ngFor=”hero of heroes”> <td>({hero.name})</td></tr> The ngFor directive instantiates a template for every element of the given iterator. The different local variables of the ngFor directive can be used in iterations. The ngFor directive can even be used with the HTML elements. It also performs various changes in DOM. Several exported values can be aliased to local variables with the help of ngFor directive. It allows us to build data presentation lists and tables in our HTML templates. Here’s an example of ngFor directive with the help of HTML: <tr *ngFor=”hero of heroes”> <td>({hero.name})</td></tr> |
|
| 8. |
Explain The Component Directory Structure Of Angular 4? |
|
Answer» Here are the elements which are present in the component directory structure anf modules: – MODULE.ts- in this, the angular module is declared. @NgModule decorator is used which initializes the different aspects of angular applications. AppComponent is also declared in it. COMPONENTS.ts- it simply DEFINES the components in angular and this is the place where the app-root sector is also defined. A TITLE attribute is also declared in the component. Component.html- it is the TEMPLATE file of the application which represents the visual parts of our components. Here are the elements which are present in the component directory structure anf modules: – Module.ts- in this, the angular module is declared. @NgModule decorator is used which initializes the different aspects of angular applications. AppComponent is also declared in it. Components.ts- it simply defines the components in angular and this is the place where the app-root sector is also defined. A title attribute is also declared in the component. Component.html- it is the template file of the application which represents the visual parts of our components. |
|
| 9. |
Write The Cli Command To Generate A Component In Angular 4? |
|
Answer» Components are just simple CLASSES which are declared as components with the help of component decorators. It becomes easy to create an APPLICATION which already works, with the help of angular CLI COMMANDS. “Ng generate” is used to generate components, routes, services, and pipes. Simple test shells are also CREATED with the help of this CLI command. For generating a component in angular4 with the help of CLI command. you need to follow the following syntax-
It generates the component and adds the component to module declarations. Components are just simple classes which are declared as components with the help of component decorators. It becomes easy to create an application which already works, with the help of angular CLI commands. “Ng generate” is used to generate components, routes, services, and pipes. Simple test shells are also created with the help of this CLI command. For generating a component in angular4 with the help of CLI command. you need to follow the following syntax- It generates the component and adds the component to module declarations. |
|
| 10. |
Explain Component Decorators In Angular 4? |
|
Answer» A decorator is the core concept when developing an angular framework with VERSION 2 and above. It may become a core language feature for JAVASCRIPT soon. In angular 4, decorators are used extensively and are ALSO used to compile a code. There are 4 different types of decorators:
A decorator is a function that is invoked with a prefix “@” symbol and is immediately FOLLOWED by a class, parameter, method, or property. A decorator returns the same thing which was given as an input but in an augmented form. A decorator is the core concept when developing an angular framework with version 2 and above. It may become a core language feature for JavaScript soon. In angular 4, decorators are used extensively and are also used to compile a code. There are 4 different types of decorators: A decorator is a function that is invoked with a prefix “@” symbol and is immediately followed by a class, parameter, method, or property. A decorator returns the same thing which was given as an input but in an augmented form. |
|
| 11. |
What Is The Json Web Token Structure? |
|
Answer» The JSON Web Tokens CONSIST of three PARTS SEPARATED by DOTS (.), which are:
The JSON Web Tokens consist of three parts separated by dots (.), which are: |
|
| 12. |
When Should You Use Json Web Tokens? |
|
Answer» There are some SCENARIOS where we can USED JSON Web TOKENS –
There are some scenarios where we can used JSON Web Tokens – |
|
| 13. |
What Is Json Web Token? |
|
Answer» JSON Web Token (JWT) is an OPEN standard which USED for SECURELY TRANSMITTING information between parties as a JSON object. The JWTs can be signed with –
JSON Web Token (JWT) is an open standard which used for securely transmitting information between parties as a JSON object. The JWTs can be signed with – |
|
| 14. |
How Are Jwts Used To Authenticate Angular 4 Applications? |
|
Answer» In Annular, the following Steps are used to building authentication and authorization for RESTful APIs and applications. It might help you –
There are several open source libraries are available for angular which are helps with JWTs and has the ability to Decode the JWT, Authorization header to XHR requests and so on. In Annular, the following Steps are used to building authentication and authorization for RESTful APIs and applications. It might help you – There are several open source libraries are available for angular which are helps with JWTs and has the ability to Decode the JWT, Authorization header to XHR requests and so on. |
|
| 15. |
How To Get And Log An Error In Angular 4? |
|
Answer» Two types of ERROR:
In the both CASES – We are using Http Error Response and return the useful information on what went wrong in this call! Two types of error: In the both cases – We are using Http Error Response and return the useful information on what went wrong in this call! |
|
| 16. |
What Happen When I Import The Same Module Twice In Angular 4? |
Answer»
|
|
| 17. |
What Classes Should I Not Add To Module's Declarations? |
|
Answer» We do not DECLARE – Module, Service, objects, strings, numbers, FUNCTIONS, entity models, configurations, business logic, and HELPER classes in the module’s DECLARATIONS. We do not declare – Module, Service, objects, strings, numbers, functions, entity models, configurations, business logic, and helper classes in the module’s declarations. |
|
| 18. |
What Classes Should I Add To Module's Declarations? |
|
Answer» We can add the declarable CLASSES LIKE components, directives and PIPES in the module’s declarations list and we can add only – components, directives and pipes classes in the @NgModule. We can add the declarable classes like components, directives and pipes in the module’s declarations list and we can add only – components, directives and pipes classes in the @NgModule. |
|
| 19. |
What Is The Difference Between `{'ngfor'}` And `{`ngforof`}` In Angular 2? |
|
Answer» Angular 2 – ngFor vs. ngFor:
Angular 2 – ngFor vs. ngFor: |
|
| 20. |
What Is The For Root Method? |
|
Answer» The for Root is a static method and it’s very easy for DEVELOPERS to configure the MODULES and the best EXAMPLE is – RouterModule.for Root. The Router MODULE also offers a for Child. It’s also a static method and use to configure the routes of lazy-loaded modules. The for Root and for Child are the traditional NAMES for methods that configure services in root. The for Root is a static method and it’s very easy for developers to configure the modules and the best example is – RouterModule.for Root. The Router Module also offers a for Child. It’s also a static method and use to configure the routes of lazy-loaded modules. The for Root and for Child are the traditional names for methods that configure services in root. |
|
| 21. |
What Is The Use Of Interceptors In Angular 4? |
|
Answer» The INTERCEPTORS is a COMMON used to SET DEFAULT headers for all responses. The Interceptors is a common used to set default headers for all responses. |
|
| 22. |
How To Set Http Request Header In Angular 4 And Angular 2? |
|
Answer» The HTTP Interceptors are USED to Set Http Headers REQUEST in Angular 4 using the import from “@angular/common/http”. The HTTP Interceptors are available in Angular 4.x versions. The HTTP Interceptors are not supported in Angular 2. We are CREATING the Http Client INJECTABLE class to ACHIEVE this. You can see the below examples for set http headers request with and without HTTP interceptors. The HTTP Interceptors are used to Set Http Headers Request in Angular 4 using the import from “@angular/common/http”. The HTTP Interceptors are available in Angular 4.x versions. The HTTP Interceptors are not supported in Angular 2. We are creating the Http Client Injectable class to achieve this. You can see the below examples for set http headers request with and without HTTP interceptors. |
|
| 23. |
Why Angular 4? What’s New In Angular 4? |
Answer»
Angular 2 apps will work using Angular 4 without changing anything. Angular 4 OFFERS lots-of ENHANCEMENTS i.e.
Angular 2 apps will work using Angular 4 without changing anything. Angular 4 offers lots-of enhancements i.e. |
|
| 24. |
What’s New In Angular 4? And What Are The Improvements In Angular 4? |
|
Answer» Angular 4 contains some additional Enhancement and Improvement. Consider the following ENHANCEMENTS:
Angular 4 contains some additional Enhancement and Improvement. Consider the following enhancements: |
|
| 25. |
What Are The Differences Between Angular And Angular Js? |
|
Answer» Angular was a ground-up rewrite of AngularJS and has many unique features.
Typescript a superset of ECMAScript 6 (ES6), and is backwards compatible with ECMAScript 5 (i.e.: JavaScript). Angular also includes the benefits of ES6:
Angular was a ground-up rewrite of AngularJS and has many unique features. Typescript a superset of ECMAScript 6 (ES6), and is backwards compatible with ECMAScript 5 (i.e.: JavaScript). Angular also includes the benefits of ES6: |
|
| 26. |
What Do I Have To Do To Trick The Browser Into Doing What I Want? |
|
Answer» The IMPEDANCE mismatch between dynamic applications and static documents is often solved with: A library – a collection of functions which are useful when writing web apps. Your code is in charge and it calls into the library when it sees fit. E.g., jQuery. Frameworks – a particular implementation of a web application, where your code fills in the details. The framework is in charge and it calls into your code when it needs something app specific. E.g., durandal, ember, etc. AngularJS takes ANOTHER APPROACH. It attempts to minimize the impedance mismatch between document centric HTML and what an application needs by creating new HTML constructs. AngularJS teaches the browser new syntax through a construct we CALL directives. Examples include:
The impedance mismatch between dynamic applications and static documents is often solved with: A library – a collection of functions which are useful when writing web apps. Your code is in charge and it calls into the library when it sees fit. E.g., jQuery. Frameworks – a particular implementation of a web application, where your code fills in the details. The framework is in charge and it calls into your code when it needs something app specific. E.g., durandal, ember, etc. AngularJS takes another approach. It attempts to minimize the impedance mismatch between document centric HTML and what an application needs by creating new HTML constructs. AngularJS teaches the browser new syntax through a construct we call directives. Examples include: |
|
| 27. |
What Is Angular Js? |
|
Answer» ANGULARJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you EXTEND HTML syntax to express your application’s components clearly and succinctly. AngularJS data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any SERVER TECHNOLOGY. AngularJS is what HTML would have been, had it been designed for applications. HTML is a great declarative language for static documents. It does not contain much in the way of creating applications, and as a result BUILDING web applications is an exercise in. AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML syntax to express your application’s components clearly and succinctly. AngularJS data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any server technology. AngularJS is what HTML would have been, had it been designed for applications. HTML is a great declarative language for static documents. It does not contain much in the way of creating applications, and as a result building web applications is an exercise in. |
|
| 28. |
What Is Angular? |
|
Answer» Angular (commonly referred to as “Angular 2+” or “Angular 2“): Is a TYPESCRIPT-based open-source front-END web application platform bed by the Angular Team at Google and by a community of individuals and corporations to address all of the parts of the developer’s workflow while building complex web application. Angular is a complete rewrite from the same team that built AngularJS. Angular is a framework for building client applications in HTML and either JavaScript or a language like TypeScript that compiles to JavaScript. Angular combines declarative templates, dependency injection, end to end TOOLING, and integrated best practices to solve development challenges. Angular empowers developers to BUILD applications that live on the web, mobile, or the DESKTOP. Angular (commonly referred to as “Angular 2+” or “Angular 2“): Is a TypeScript-based open-source front-end web application platform bed by the Angular Team at Google and by a community of individuals and corporations to address all of the parts of the developer’s workflow while building complex web application. Angular is a complete rewrite from the same team that built AngularJS. Angular is a framework for building client applications in HTML and either JavaScript or a language like TypeScript that compiles to JavaScript. Angular combines declarative templates, dependency injection, end to end tooling, and integrated best practices to solve development challenges. Angular empowers developers to build applications that live on the web, mobile, or the desktop. |
|
| 29. |
What Are The Features Of Angular 4.3? |
|
Answer» FEATURES in Angular version 4.3 are:
Features in Angular version 4.3 are: |
|
| 30. |
What Are Angular 4? |
|
Answer» On 13 December 2016 Angular 4 was ANNOUNCED, skipping 3 to avoid confusion DUE to the misalignment of the router package’s version which was already distributed as v3.3.0. The final version was released on March 23, 2017. Angular 4 is backward compatible with Angular 2. Angular version 4.3 is a minor release, MEANING that it contains no breaking changes and that it is a drop-in replacement for 4.x.x. On 13 December 2016 Angular 4 was announced, skipping 3 to avoid confusion due to the misalignment of the router package’s version which was already distributed as v3.3.0. The final version was released on March 23, 2017. Angular 4 is backward compatible with Angular 2. Angular version 4.3 is a minor release, meaning that it contains no breaking changes and that it is a drop-in replacement for 4.x.x. |
|