Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What is Bootstrapping in AngularJS

Answer»

What is Bootstrapping in AngularJS
Below are the some of very important POINTS of AngularJS which help US to under stand what is Bootstrapping
(1)When we INITIALIZED the ANGULAR App it is called Bootstrappingin AngularJS.
(2)ng-app directive also HELPS to understand which is the root of AngularJS application. It could be either the entire HTML page or can be some portion of that page.
(3)Once we declare the Root Angular reads the HTML within that root and compiles it into an internal representation. And that reading and compiling is called as Bootstrapping process.

2.

Example of using filter in an Angular controller:

Answer»

Example of using filter in an Angular controller
Below is the example of using filter in an Angular controller and synatx is GIVEN below:-
$scope.ListOfBooks = [
{ BookID: 1, Name: "ASP.NET", Price: "600", Level: "I" },
{ BookID: 2, Name: "C#", Price: "1000", Level: "I" },
{ BookID: 3, Name: "VB.NET", Price: "700", Level: "III" },
{ BookID: 4, Name: "Java", Price: "800", Level: "III" },
{ BookID: 5, Name: "Perl", Price: "1000", Level: "II" },
{ BookID: 6, Name: "Cobol", Price: "500", Level: "I" }
];

$scope.ListOfLevel = $scope.ListOfBooks.filter(function (Book) {
RETURN (Book.Level == "III");
});

// This will display "There are 2 Books for Level III."
PROMPT("", "There are " + $scope.ListOfLevel.length + " books for level III.");

3.

What is use of ng-init directive in angular

Answer»

What is use of NG-init directive in angular
ng-init directive initializes AngularJS application variables. We will use ng-init to initializes some values. We can alse use data-ng-, INPLACE of ng-, if we need to make our page HTML valid.

Below is the syntax to use ng-init:-

< div data-ng-app="" data-ng-init="websitename='crackyourinterview'">
< p>The name is < span data-ng-bind="websitename"> < /span> < < /p>
< /div>

4.

Explain bootstrapping in Angular?

Answer»

Explain bootstrapping in Angular?
Angular bootstrapping helps to initialize or START the Angular application. And Angular supports both manual and AUTOMATIC bootstrapping. Below are some more DETAILS of bootstrapping in Angular:-
(1)Manual bootstrapping:-In manual bootstarp in angular it gives more power to professionals in term of how and when NEED to initialize the angular app. It is very helpful where professionals need to perform other tasks and other OPERATION before the Angular compiles the page.
(2)Automatic bootstrapping:-In this angular bootstrap we use this to add ng-app directive to a our application root. Angular loads the associated module once it finds the ng-app directive and, further, compiles the DOM.

5.

Some basic of Angular 2?

Answer»

Some basic of ANGULAR 2?
Angular 2 is also JavaScript Frameworks to create a web and mobile applications. Angular2 supports TypeScript which is super script of JavaScript and which helps in safe coding. Angular2 has several enhancements on top of Angular 1.x which make it simple to get desired output. And one important aspects is that Angular 1.x is not necessary to learn Angular 2 since whole framework is re-written.
There are so MANY other features of Angular2:-
(1)It is cross-plateform framework
(2)It is faster due to server side RENDERING
(3)Angular 2 focuses only on building JavaScript classes so it is EASIER to learn.
(4)It provides more choices of languages like ES5, ES6, Typescript and dart.
(5)It uses Hierarchical Dependency Injection system, which is a performance booster.
(6)It uses Component BASED approach with no controllers and $scope.

6.

What are the different task which directives performs in AngularJS

Answer»

What are the different task which directives performs in AngularJS
Below are the 5 main task that is being performed by AngularJS
(1)DOM Manipulation
(2)Data BINDING
(3)Refer Controllers and MODULES
(4)Events HANDLING
(5)CSS modification

7.

Six main difference between React and Angular

Answer»

Six main DIFFERENCE between React and Angular
Below are the Six main differences between Angular and React
(1)Author:-
(i)React is OWNED by the Facebook
(i)Angular support is in hand of Google
(2)DOM:-
(i)React uses virtual DOM
(i)Angular uses real DOM
(3)Architecture:-
(i)React have only the VIEW of MVC(Model View Controller)
(i)Angular have complete MVC
(4)DEBUGGING:-
(i)React have the compile time debugging
(ii)Angular have runtime debugging
(5)Rendering:-
(i)React have server-side rendering
(i)Angular have client-side rendering
(6)Data BINDING:-
(i)React have the one-way data binding
(ii)Angular have two way data binding

8.

Write down 11 main difference between Angular and React?

Answer»

Write down 11 main difference between Angular and React?
Below is 11 main difference between Angular and React
(1)Author:-Angular author is Google and React is handle by Facebook Community.
(2)Developer:-Angular developer is Misko Hevery and React developer name is Jordan Walke.
(3)Release Data(Initial):-Angular date is "October 2010" and React date is "MARCH 2013"
(4)Language:-Angular language is JavaScript and HTML and react uses only JSX.
(5)Performance:-Performance wise Angular is little bit SLOW on the other hand React is Fast(Due to Virtual DOM).
(6)Render:-Angular is Client-Side and React is on Server-Side.
(7)DOM:-Angular is Regular DOM and React is Virtual DOM.
(8)Data-Binding:-Angular is Bi-directional and React is Uni-directional.
(9)Testing:-Angular have Unit and Integration Testing and on other side React is Unit Testing.
(10)App Architecture:-Angular have MVC support and React have Flux.
(11)Type:- Angular is Open Source MVC Framework and React is Open Source JS Framework.

9.

Ways of Bootstrapping in Angular

Answer» WAYS of Bootstrapping in Angular
There are 2 ways of Bootstrapping in Angular
(1)Automatic Bootstrapping
(2)Manual Bootstrapping
(1)Automatic Bootstrapping:-When we add ng-app directive in HTML or Body tag of HTML then Angular is auto-bootstrapped to the application. Once AngularJS finds the ng-app directive , it loads the module associated with it and then COMPILES the DOM.
(2)Manual Bootstrapping:-In this INITIALIZATION HAPPEN inside the script after app is created.
10.

Define the ng-content Directive

Answer»

Define the NG content Directive
In CONVENTIONAL HTML elements wher we have some content between the tags. To under stand this we take below 2 example:-

(1)< p>Here you get all question on cracyourinterview.com< /p>
(2)< h1>Here you will get cracyourinterview< /p>

Now we will consider the following example of having custom text between angular tags as per below eample:-

< app-work>This have question in crackyourinterview.com < /app-work>


But all these will not work in angular so in PLACE of this we NEED to use the ng-content Directive. Moreover, it is helpful in building reusable components.

We use this tag as a placeholder for that dynamic content, then when the template is parsed Angular will replace that placeholder tag with your content

11.

How to link AngularJS Script file with HTML

Answer»

How to link AngularJS Script FILE with HTML
There are 2 WAYS to link AngularJS script files with HTML.
(1)First way is to DOWNLOAD the ANgularJS to machine and then include script from the local machine url like given below
< script src="script/angular.js" type="text/javascript" >< /script>

(2)And the 2nd is to include script from CDN as given below
< script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js">< /script>

12.

Define ng-if directive

Answer»

Define ng-if directive
If we need to remove or recreate some portion of HTML element based on certain EXPRESSION we need ng-if Directive. ng-if is DIFFERENT from ng-hide because it will remove element in the DOM rather than just HIDING the display of element. If the expression INSIDE it is false then the element is removed and if it is true then the element is added to the DOM.

For example below is the syntax
< element ng-if="expression"> Contents...< /element>

if expression returns true then element is created and if it return the false then element is completely removed.

13.

What is Transpiling in Angular?

Answer»

What is Transpiling in Angular?
Transpiling is the one o the process to convert the typescript into javascript. We can do this by using Traceur, a JS compiler. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Which offers classes, modules, and interfaces to HELP you BUILD robust components. In another way we can say that LANGUAGES we write that transpile to JavaScript are OFTEN called compile-to-JS languages, and are said to target JavaScript. Though typescript is used to write CODE in the Angular applications, the code is internally transpiled into javascript.

14.

Provide name of some inbuilt angular filters ?

Answer» PROVIDE name of some inbuilt angular filters ?
Below are the DIFFERENT inbuit angular filters
(1)CURRENCY
(2)lowercase
(3)UPPERCASE
(4)number
(5)date