AngularJS Technical Interview Questions Answers

What is AngularJS?
AngularJS is a javascript framework used for creating single web page applications. It allows you to use HTML as your template language and enables you to extend HTML’s syntax to express your application’s components clearly AngularJS is a framework to build large-scale and high-performance web applications while keeping them as easy-to-maintain. Following are the features of the AngularJS framework. AngularJS is a powerful JavaScript-based development framework to create RICH Internet Application (RIA). AngularJS provides developers options to write client-side applications (using JavaScript) in a clean MVC (Model View Controller) way. An application written in AngularJS is cross-browser compliant. AngularJS automatically handles JavaScript code suitable for each browser. AngularJS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0... Initially, it was developed by Misko Hevery and Adam Abrons. Currently, it is being developed by Google.



Mention what are the advantages of using AngularJS?
AngularJS has several advantages in web development.
  • AngularJS supports MVC pattern
  • Can do two ways data binding using AngularJS
  • It has pre-defined form validations
  • It supports both client server communication
  • It supports animations


Mention what are the advantages of using the Angular.js framework?
Advantages of using Angular.js as a framework are
  • Supports two way data-binding
  • Supports MVC pattern
  • Support static template and angular template
  • Can add custom directive
  • Supports REST full services
  • Supports form validations
  • Support both client and server communication
  • Support dependency injection
  • Applying Animations
  • Event Handlers


What is data binding in AngularJS?
Data binding is the automatic synchronization of data between model and view components. ng-model directive is used in data binding.


What is the scope in AngularJS?
Scope refers to the application model, it acts like glue between the application controller and the view. Scopes are arranged in a hierarchical structure and impersonate the DOM ( Document Object Model) structure of the application. It can watch expressions and propagate events.


What are the controllers in AngularJS?
Controllers are JavaScript functions that are bound to a particular scope. They are the prime actors in AngularJS framework and carry functions to operate on data and decide which view is to be updated to show the updated model based data.


What are the services in AngularJS?
In AngularJS services are the singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these functions can be called controllers, directives, filters, and so on.


What are the filters in AngularJS?
Filters select a subset of items from an array and return a new array. Filters are used to show filtered items from a list of items based on defined criteria.


Explain directives in AngularJS?

Directives are markers on DOM elements (such as elements, attributes, css, and more). These can be used to create custom HTML tags that serve as new, custom widgets. AngularJS has built-in directives (ng-bind, ng-model, etc) to perform most of the tasks that developers have to do.


Explain templates in AngularJS?
Templates are the rendered view with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using "partials".


What is routing in AngularJS?
Angular js routes enable you to create different URLs for different content in your application. Different URLs for different content enable users to bookmark URLs to specific content. Each such bookmarkable URL in AngularJS is called a route It is the concept of switching views. AngularJS based controller decides which view to render based on the business logic.

A value in Angular JS is a simple object. It can be a number, string, or JavaScript object. Values are typically used as configuration injected into factories, services, or controllers. A value should belong to an AngularJS module.

Injecting a value into an AngularJS controller function is done by adding a parameter with the same name as the value.

What makes AngularJS better?

Registering Callbacks: There is no need to register callbacks. This makes your code simple and easy to debug.
Control HTML DOM programmatically: All the applications that are created using Angular never have to manipulate the DOM although it can be done if it is required
Transfer data to and from the UI: AngularJS helps to eliminate almost all of the boilerplate like validating the form, displaying validation errors, returning to an internal model and so on which occurs due to the flow of marshaling data
No initilization code: With AngularJS you can bootstrap your app easily using services, which auto-injected into your application in Guice-like dependency injection style.


What is deep linking in AngularJS?

Deep linking allows you to encode the state of an application in the URL so that it can be bookmarked. The application can then be restored from the URL to the same state.

What are the advantages of AngularJS?

AngularJS provides the capability to create Single Page Applications in a very clean and maintainable way. AngularJS provides data binding capability to HTML thus giving users a rich and responsive experience. AngularJS code is unit testable. AngularJS uses dependency injection and makes use of separation of concerns. AngularJS provides reusable components. With AngularJS, the developer writes less code and gets more functionality. In AngularJS, views are pure html pages, and controllers written in JavaScript do the business processing. AngularJS applications can run on all major browsers and smartphones including Android and iOS based phones/tablets.

What are the disadvantages of AngularJS?

Not Secure − Being a JavaScript-only framework, applications written in AngularJS are not safe. Server-side authentication and authorization are a must to keep an application secure. Not degradable − If your application user disables JavaScript then the user will just see the basic page and nothing more.

Which are the core directives of AngularJS?

ng-app − This directive defines and links an AngularJS application to HTML. ng-model − This directive binds the values of AngularJS application data to HTML input controls. ng-bind − This directive binds the AngularJS Application data to HTML tags.

Explain AngularJS boot process?

When the page is loaded in the browser, the following things happen: HTML document is loaded into the browser, and evaluated by the browser. AngularJS JavaScript file is loaded; the angular global object is created. Next, JavaScript which registers controller functions is executed. Next AngularJS scans through the HTML to look for AngularJS apps and views. One view is located, it connects that view to the corresponding controller function. Next, AngularJS executes the controller functions. It then renders the views with data from the model populated by the controller. The page gets ready.

What is MVC?

Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts: Model − It is the lowest level of the pattern responsible for maintaining data. View − It is responsible for displaying all or a portion of the data to the user. Controller − It is a software Code that controls the interactions between the Model and View.

Explain ng-app directive?

ng-app directive defines and links an AngularJS application to HTML. It also indicates the start of the application.

Explain ng-model directive?

ng-model directive binds the values of AngularJS application data to HTML input controls. It creates a model variable that can be used with the html page and within the container control( for example, div) having an ng-app directive.

Explain ng-bind directive?

ng-bind directive binds the AngularJS Application data to HTML tags. ng-bind updates the model created by the ng-model directive to be displayed in the html tag whenever the user input something in the control or updates the html control's data when model data is updated by the controller.

Explain ng-controller directive?

the ng-controller directive tells AngularJS what controller to use with this view. AngularJS application mainly relies on controllers to control the flow of data in the application. A controller is a JavaScript object containing attributes/properties and functions. Each controller accepts $scope as a parameter which refers to the application/module that the controller is to control.

How does AngularJS integrate with HTML?

AngularJS being a pure javaScript based library integrates easily with HTML. Step 1 − Include Angularjs javascript library in the html page <head> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> </script> </head> Step 2 − Point to AngularJS app Next we tell what part of the HTML contains the AngularJS app. This done by adding the ng-app attribute to the root HTML element of the AngularJS app. You can either add it to html element or body element as shown below: <body ng-app = "myapp"> </body>

Explain ng-init directive?

ng-init directive initializes an AngularJS Application data. It is used to put values to the variables to be used in the application.

Explain ng-repeat directive?

ng-repeat directive repeats html elements for each item in a collection.

What are AngularJS expressions?

Expressions are used to bind application data to html. Expressions are written inside double braces like {{ expression}}. Expressions behave in the same way as ng-bind directives. AngularJS application expressions are pure JavaScript expressions and output the data where they are used.

Explain the uppercase filter?

Uppercase filter converts a text to upper case text. In below example, we've added uppercase filter to an expression using pipe character. Here we've added uppercase filter to print student name in all capital letters. Enter first name:<input type = "text" ng-model = "student.firstName"> Enter last name: <input type = "text" ng-model = "student.lastName"> Name in Upper Case: {{student.fullName() | uppercase}}

Explain lowercase filter?

Lowercase filter converts a text to lower case text. In below example, we've added lowercase filter to an expression using pipe character. Here we've added lowercase filter to print student name in all lowercase letters. Enter first name:<input type = "text" ng-model = "student.firstName"> Enter last name: <input type = "text" ng-model = "student.lastName"> Name in Upper Case: {{student.fullName() | lowercase}}

Explain currency filter?

Currency filter formats text in a currency format. In below example, we've added currency filter to an expression returning number using pipe character. Here we've added currency filter to print fees using currency format. Enter fees: <input type = "text" ng-model = "student.fees"> fees: {{student.fees | currency}}

Explain filter?

filter filter is used to filter the array to a subset of it based on provided criteria. In below example, to display only required subjects, we've used subjectName as filter. Enter subject: <input type = "text" ng-model = "subjectName"> Subject: <ul> <li ng-repeat = "subject in student.subjects | filter: subjectName"> {{ subject.name + ', marks:' + subject.marks }} </li> </ul>

Explain orderby filter?

orderby filter orders the array based on provided criteria. In below example, to order subjects by marks, we've used orderBy marks. Subject: <ul> <li ng-repeat = "subject in student.subjects | orderBy:'marks'"> {{ subject.name + ', marks:' + subject.marks }} </li> </ul>

Explain ng-disabled directive?

ng-disabled directive disables a given control. In below example, we've added ng-disabled attribute to a HTML button and pass it a model. Then we've attached the model to an checkbox and can see the variation. <input type = "checkbox" ng-model = "enableDisableButton">Disable Button <button ng-disabled = "enableDisableButton">Click Me!</button>

Explain ng-show directive?

ng-show directive shows a given control. In below example, we've added ng-show attribute to a HTML button and pass it a model. Then we've attached the model to a checkbox and can see the variation. <input type = "checkbox" ng-model = "showHide1">Show Button <button ng-show = "showHide1">Click Me!</button>

Explain ng-hide directive?

ng-hide directive hides a given control. In below example, we've added ng-hide attribute to a HTML button and pass it a model. Then we've attached the model to a checkbox and can see the variation. <input type = "checkbox" ng-model = "showHide2">Hide Button <button ng-hide = "showHide2">Click Me!</button>

Explain ng-click directive?

ng-click directive represents a AngularJS click event. In below example, we've added ng-click attribute to a HTML button and added an expression to updated a model. Then we can see the variation. <p>Total click: {{ clickCounter }}</p></td> <button ng-click = "clickCounter = clickCounter + 1">Click Me!</button>

How angular.module works?

the angular. the module is used to create AngularJS modules along with their dependent modules. Consider the following example: var mainApp = angular.module("mainApp", []); Here we've declared an application mainApp module using angular.module function. We've passed an empty array to it. This array generally contains dependent modules declared earlier.

How to validate data in AngularJS?

AngularJS enriches form filling and validation. We can use $dirty and $invalid flags to do the validations seamlessly. Use novalidate with a form declaration to disable any browser-specific validation. The following can be used to track errors. $dirty − states that value has been changed. $invalid − states that the value entered is invalid. $error − states the exact error.

Explain ng-include directive?

Using AngularJS, we can embed HTML pages within a HTML page using ng-include directive. <div ng-app = "" ng-controller = "studentController"> <div ng-include = "'main.htm'"></div> <div ng-include = "'subjects.htm'"></div> </div>

How to make an ajax call using Angular JS?

AngularJS provides $https: control which works as a service to make ajax call to read data from the server. The server makes a database call to get the desired records. AngularJS needs data in JSON format. Once the data is ready, $https: can be used to get the data from server in the following manner: function studentController($scope,$https:) { var url = "data.txt"; $https:.get(url).success( function(response) { $scope.students = response; }); }

What is the use of $routeProvider in AngularJS?

$routeProvider is the key service that sets the configuration of urls, maps them with the corresponding html page or ng-template, and attaches a controller with the same.

What is $rootScope?

The scope is a special JavaScript object which plays the role of joining the controller with the views. Scope contains the model data. In controllers, model data is accessed via the $scope object. $rootScope is the parent of all of the scope variables.

What is the scope hierarchy in AngularJS?

Scopes are controllers specific. If we define nested controllers then child controller will inherit the scope of its parent controller. <script> var mainApp = angular.module("mainApp", []); mainApp.controller("shapeController", function($scope) { $scope.message = "In shape controller"; $scope.type = "Shape"; }); mainApp.controller("circleController", function($scope) { $scope.message = "In circle controller"; }); </script> Following are the important points to be considered in above example. We've set values to models in shapeController. We've overridden message in child controller circleController. When "message" is used within module of controller circleController, the overridden message will be used.

What is a service?

Services are JavaScript functions and are responsible to do specific tasks only. Each service is responsible for a specific task, for example, $https: is used to make an ajax call to get the server data. $route is used to define the routing information and so on. Inbuilt services are always prefixed with the $ symbol.

What is service method?

Using service method, we define a service and then assign method to it. We've also injected an already available service to it. mainApp.service('CalcService', function(MathService){ this.square = function(a) { return MathService.multiply(a,a); } });

What is the factory method?

Using factory method, we first define a factory and then assign method to it. var mainApp = angular.module("mainApp", []); mainApp.factory('MathService', function() { var factory = {}; factory.multiply = function(a, b) { return a * b } return factory; });

What are the differences between service and factory methods?

factory method is used to define a factory which can later be used to create services as and when required whereas service method is used to create a service whose purpose is to do some defined task.

A service() in Angular is a function that is used for the business layer of the application. It operates as a constructor function and is invoked once at the runtime using the ‘new’ keyword. Whereas factory() is a function that works similar to the service() but is much more powerful and flexible. factory() are design patterns that help in creating Objects.

Which components can be injected as a dependency in AngularJS?

AngularJS provides a supreme Dependency Injection mechanism. It provides the following core components which can be injected into each other as dependencies. value factory service provider constant

What is provider?

provider is used by AngularJS internally to create services, factory etc. during config phase(phase during which AngularJS bootstraps itself). Below mention script can be used to create MathService that we've created earlier. Provider is a special factory method with a method get() which is used to return the value/service/factory. //define a module var mainApp = angular.module("mainApp", []); ... //create a service using provider which defines a method square to return square of a number. mainApp.config(function($provide) { $provide.provider('MathService', function() { this.$get = function() { var factory = {}; factory.multiply = function(a, b) { return a * b; } return factory; }; }); });

What is constant?

constants are used to pass values at the config phase because values cannot be used to be passed during the config phase. mainApp.constant("configParam", "constant value");

Is AngularJS extensible?

Yes! In AngularJS we can create a custom directive to extend AngularJS existing functionalities. Custom directives are used in AngularJS to extend the functionality of HTML. Custom directives are defined using the "directive" function. A custom directive simply replaces the element for which it is activated. AngularJS application during bootstrap finds the matching elements and does one-time activity using its compile() method of the custom directive then process the element using link() method of the custom directive based on the scope of the directive.

On which types of component can we create a custom directive?

AngularJS provides support to create custom directives for the following type of elements. Element directives − Directive activates when a matching element is encountered. Attribute − Directive activates when a matching attribute is encountered. CSS − Directive activates when a matching css style is encountered. Comment − Directive activates when a matching comment is encountered.

What is internationalization?

Internationalization is a way to show locale-specific information on a website. For example, display content of a website in the English language in the United States and in Danish in France.

How to implement internationalization in AngularJS?

AngularJS supports inbuilt internationalization for three types of filters currency, date and numbers. We only need to incorporate corresponding js according to locale of the country. By default it handles the locale of the browser. For example, to use Danish locale, use following script <script src = "https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js"> </script>

Explain what is the difference between AngularJS and backbone.js?

AngularJS combines the functionalities of most of the 3rd party libraries, it supports individual functionalities required to develop HTML5 Apps. While Backbone.js do their jobs individually.

Explain jQLite.
jQlite is also known as jQuery lite is a subset of jQuery and contains all its features. It is packaged within Angular, by default. It helps Angular to manipulate the DOM in a way that is compatible cross-browser. jQLite basically implements only the most commonly needed functionality which results in having a small footprint.

What are the different types of filters in Angular?
Below are the various filters supported by Angular:
  • currency: Format a number to a currency format.
  • date: Format a date to a specified format.
  • filter: Select a subset of items from an array.
  • json: Format an object to a JSON string.
  • limit: To Limits an array/string, into a specified number of elements/characters.
  • lowercase: Format a string to lower case.
  • number: Format a number to a string.
  • orderBy: Orders an array by an expression.
  • uppercase: Format a string to upper case.
 
What do you understand by REST in Angular?
REST stands for REpresentational State Transfer. REST is an API (Application Programming Interface) style that works on the HTTP request. In this, the requested URL pinpoints the data that needs to be processed. Further ahead, an HTTP method then identifies the specific operation that needs to be performed on that requested data. Thus, the APIs which follow this approach is known as RESTful APIs.


What is Angular mainly used for?
Angular is typically used for the development of SPA which stands for Single Page Applications. Angular provides a set of ready-to-use modules that simplify the development of single page applications. Not only this, with features like built-in data streaming, type safety, and a modular CLI, Angular is regarded as a full-fledged web framework.


What is the difference between an Annotation and a Decorator in Angular?
Annotations in angular are “only” metadata set of the class using the Reflect Metadata library. They are used to create an “annotation” array. On the other hand, decorators are the design patterns that are used for separating decoration or modification of a class without actually altering the original source code.


What is the purpose of a filter in Angular?
Filters in Angular are used for formatting the value of an expression to display it to the user. These filters can be added to the templates, directives, controllers, or services. Not just this, you can create your own custom filters. Using them, you can easily organize data in such a way that the data is displayed only if it fulfills certain criteria. Filters are added to the expressions by using the pipe character |, followed by a filter.


What is a provider in Angular?
A provider is a configurable service in Angular. It is an instruction to the Dependency Injection system that provides information about the way to obtain a value for a dependency. It is an object that has a $get() method which is called to create a new instance of a service. A Provider can also contain additional methods and uses $provide in order to register new providers.


What is the difference between a service() and a factory()?
A service() in Angular is a function that is used for the business layer of the application. It operates as a constructor function and is invoked once at the runtime using the ‘new’ keyword. Whereas factory() is a function that works similar to the service() but is much more powerful and flexible. factory() are design patterns that help in creating Objects.


What is the difference between $scope and scope in Angular?
$scope in Angular is used for implementing the concept of dependency injection (D.I) on the other hand scope is used for directive linking.

$scope is the service provided by $scopeProviderwhich can be injected into controllers, directives or other services whereas Scope can be anything such as a function parameter name, etc.


What is AOT?
AOT stands for Angular Ahead-of-Time compiler. It is used for pre-compiling the application components and along with their templates during the build process. Angular applications which are compiled with AOT has a smaller launching time. Also, components of these applications can execute immediately, without needing any client-side compilation. Templates in these applications are embedded as code within their components. It reduces the need for downloading the Angular compiler which saves you from a cumbersome task. AOT compiler can discard the unused directives which are further thrown out using a tree-shaking tool.


Explain jQLite.
jQlite is also known as jQuery lite is a subset of jQuery and contains all its features. It is packaged within Angular, by default. It helps Angular to manipulate the DOM in a way that is compatible cross-browser. jQLite basically implements only the most commonly needed functionality which results in having a small footprint.


What are the Angular Modules?
All the Angular apps are modular and follow a modularity system known as NgModules. These are the containers which hold a cohesive block of code dedicated specifically to an application domain, a workflow, or some closely related set of capabilities. These modules generally contain components, service providers, and other code files whose scope is defined by the containing NgModule. With modules makes the code becomes more maintainable, testable, and readable. Also, all the dependencies of your applications are generally defined in modules only.


What are the different types of filters in Angular?
Below are the various filters supported by Angular:

currency: Format a number to a currency format.
date: Format a date to a specified format.
filter: Select a subset of items from an array.
json: Format an object to a JSON string.
limit: To Limits an array/string, into a specified number of elements/characters.
lowercase: Format a string to lower case.
number: Format a number to a string.
orderBy: Orders an array by an expression.
uppercase: Format a string to upper case.


Differentiate between one-way binding and two-way data binding.
In One-Way data binding, the View or the UI part does not update automatically whenever the data model changes. You need to manually write custom code in order to update it every time the view changes. Whereas, in Two-way data binding, the View or the UI part is updated implicitly as soon as the data model changes. It is a synchronization process, unlike One-way data binding.


What do you understand by dirty checking in Angular?
In Angular, the digest process is known as dirty checking. It is called so as it scans the entire scope for changes. In other words, it compares all the new scope model values with the previous scope values. Since all the watched variables are contained in a single loop, any change/update in any of the variable leads to reassigning of rest of the watched variables present inside the DOM. A watched variable is in a single loop(digest cycle), any value change of any variable forces to reassign values of other watched variables in DOM


What are events in Angular?
Events in Angular are specific directives that help in customizing the behavior of various DOM events. Few of the events supported by Angular are listed below:

ng-click
ng-copy
ng-cut
ng-dblclick
ng-keydown
ng-keypress
ng-keyup
ng-mousedown
ng-mouseenter
ng-mouseleave
ng-mousemove
ng-mouseover
ng-mouseup
ng-blur



What is a singleton pattern and where we can find it in Angular?
Singleton pattern in Angular is a great pattern which restricts a class from being used more than once. Singleton pattern in Angular is majorly implemented on dependency injection and in the services. Thus, if you use ‘new Object()’ without making it a singleton, then two different memory locations will be allocated for the same object. Whereas, if the object is declared as a singleton, in case it already exists in the memory then simply it will be reused.


What do you understand by REST in Angular?
REST stands for REpresentational State Transfer. REST is an API (Application Programming Interface) style that works on the HTTP request. In this, the requested URL pinpoints the data that needs to be processed. Further ahead, an HTTP method then identifies the specific operation that needs to be performed on that requested data. Thus, the APIs which follows this approach are known as RESTful APIs.


What is the difference between a link and compile in Angular?
Compile function is used for template DOM Manipulation and to collect all the directives. Link function is used for registering DOM listeners as well as instance DOM manipulation and is executed once the template has been cloned.


What do you understand by constants in Angular?
In Angular, constants are similar to the services which are used to define the global data. Constants are declared using the keyword “constant”. They are created using constant dependency and can be injected anywhere in controller or services.


Explain ng-app directive in Angular.
ng-app directive is used to define Angular applications which let us use the auto-bootstrap in an Angular application. It represents the root element of an Angular application and is generally declared near or tag. Any number of ng-app directives can be defined within an HTML document but just a single Angular application can be officially bootstrapped implicitly. Rest of the applications must be manually bootstrapped.


What is the digest cycle in AngularJs?
It is a part of the process of data binding in AngularJs. It compares the old and new version of the scope model value in each digest cycle. The digest cycle is triggered automatically. We can also enhance the usability by using $apply (), if we want to trigger the digest cycle manually.


Difference between sessionStorage, cookies, and localStorage.
SessionStorage – The data is stored for a particular session. The data will be lost whenever the browser tab will be closed or after some particular session. Maximum size stored can be up to 5MB.

LocalStorage – The data is stored with no expiration date. The data can only be cleared by JavaScript or by clearing the browser cache. Storage limit is maximum than the sessionStorage and cookie.

Cookies – It stores the data that has to be sent back to the server with some requests. The cookie's expiration varies on the type and duration set from either the server side or client side. Maximum size stored can be less than 4KB.

How are AngularJs prefixes $ and $$ used?

$$ variable in AngularJS is used as a private variable, as it is used to prevent accidental code collision with the user code.

Whereas $ prefix can be used to denote angular core functionalities (like a variable, parameter, property, or method).


What is SPA (Single page application) in AngularJs?
It is a web application which loads a single HTML page and dynamically updates the page as the user connects with the app.

By using AJAX and HTML a fluid and responsive web app can be created by SPA without invariant page reloads. Through this, we can make responsive UI with no page flicker.


What is ng-repeat directive in AngularJs?
It renders or iterates over a collection of items and creates DOM elements. It regularly monitors the source of data to re-render a template in response to a change.


What is ng-switch in AngularJs?
It is used to conditionally exchange the structure of DOM on a template which is based on a scope-based expression. This directive lets you show or hide the HTML element depending on the expression.


What is the use of a double-click event in AngularJs?
It allows you to specify the custom behavior on a double click event of the mouse on a web page. We can use it (ng-dblclick) as an attribute of the HTML element


What is Event Handling?
Event handling in AngularJs is very useful when you want to create advance AngularJs applications. We need to handle DOM events like mouse clicks, moves, keyboard presses, change events and so on. AngularJs has some listener directives like ng-click, ng-dbl-click, ng-mousedown, ng-keydown, ng-keyup etc.


Explain the advantages of AngularJS.
AngularJS supports MVC form.
Organize two ways data binding using AngularJS.
It supports mutual client-server communication.
It supports simulations.


What is the difference between AJAX and AngularJs?
AJAX stands for Asynchronous JavaScript which is used for sending and getting responses from the server without loading the page.

Whereas, AngularJS is a typescript language based JavaScript framework following the MVC pattern.


What is the difference between ngRoute and ui-router? 
ngRoute is a module developed by angularJS team which was a part of the core angularJS framework. Whereas ui-router was developed by a third-party community to overcome the problems of ngRoute.

ngRoute is a location or URL based routing, and ui-router is a state-based routing which allows nested views.

Compare the ‘link’ and ‘compile’ functions.

Some of your AngualrJS interview questions might require you to compare certain Angular features. It is best to keep these comparisons short and simple, rather than to go on and try to look like a know-it-all, yet fail miserably.

‘Link’ is used to produce a live view. What it does is that it takes the directives and blends them with the scope.

The ‘compile’ function collects directives and alters certain DOM (Document Object Models) templates.



What is internationalization?
When it comes to basic AngularJS interview questions and answers, this one might prove to be a bit of a bigger challenge. It honestly depends on just how deep your interviewer might want to go with it.

To put it very simply, internalization is a process where you would implement location-specific data into your website. The most common practice for this happens when you want to create a site that would be accessible by multiple languages.

This process is set to the default browser that the user is on at the time of accessing the site. If you wanted to make it location-specific, you would have to implement specific attributes depending on the targeted country.


What is the main difference between AngularJS and Angular 2?
A lot of developers and Angular users do agree on a single main difference between the two versions of Angular.

This difference has got to do with the scripts that are used within these frameworks. AngularJS uses Javascript, while Angular 2 uses Typescript to create its apps.


What is the most popular program to test AngularJS apps?
As of late, when it comes to AngularJS interview questions, Jasmine is considered by many to be the go-to choice when looking for programs to test their created Angular applications. Jasmine is a framework that allows you to fully customize your tests and document the outcomes along the way.


What is “E2E testing”?
Although it might sound like one of the fancier AngularJS interview questions, the explanation behind E2E testing is pretty simple.

“E2E” is an abbreviation of “end-to-end” testing. It is a form of testing that is focused on checking if your application runs properly and smoothly. As the name implies, E2E testing is thorough and examines your app from front to back.


What is ‘$locale’?
The $locale the function is used to define the location rules for your application.


What is ‘bootstrapping’?
bootstrapping can simply be defined as running the Angular application that you have developed. Whilst using Angular, you can do this in two ways: manually or automatically.
Previous Post Next Post