Important Angular Js Interview Questions Part – 2
What Is Angular Js?
Angular JS is a framework to build large scale and high performance web application while keeping them as easy-to-maintain.
Following are the features of Angular JS framework.
1.Angular JS is a powerful JavaScript based development framework to create RICH Internet Application (RIA).
2.Angular JS provides developers options to write client side application (using JavaScript) in a clean MVC (Model View Controller) way.
3.Application written in Angular JS is cross-browser compliant. Angular JS automatically handles JavaScript code suitable for each browser.
4.Angular JS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.
What Is Data Binding In Angular Js?
Data binding is the automatic synchronization of data between model and view components. ng-model directive is used in data binding.
What Is Scope In Angular Js?
Scopes are objects that refer to the model. They act as glue between controller and view.
What Are The Controllers In Angular Js?
Controllers are JavaScript functions that are bound to a particular scope. They are the prime actors in Angular JS 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 Angular Js?
Angular JS come with several built-in services. For example $http service is used to make XMLHttpRequests (Ajax calls). Services are singleton objects which are instantiated only once in app.
What Are The Filters In Angular Js?
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 Angular Js.
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. Angular JS has built-in directives (ng-bind, ng-model, etc) to perform most of the task that developers have to do.
Explain Templates In Angular Js.
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 Angular Js?
It is concept of switching views. Angular JS based controller decides which view to render based on the business logic.
What Is Deep Linking In Angular Js?
Deep linking allows you to encode the state of 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 Angular Js?
Advantages of Angular JS:
1.Angular JS provides capability to create Single Page Application in a very clean and maintainable way.
2.Angular JS provides data binding capability to HTML thus giving user a rich and responsive experience.
3.Angular JS code is unit testable.
4.Angular JS uses dependency injection and make use of separation of concerns.
5.Angular JS provides reusable components.
6.With Angular JS, developer writes less code and gets more functionality.
7.In Angular JS, views are pure html pages, and controllers written in JavaScript do the business processing.
8.Angular JS applications can run on all major browsers and smart phones including Android and iOS based phones/tablets.
How To Implement Internationalization In Angular Js?
Angular JS 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
What Is Internationalization?
Internationalization is a way to show locale specific information on a website. For example, display content of a website in English language in United States and in Danish in France.
On Which Types Of Component Can We Create A Custom Directive?
Angular JS provides support to create custom directives for 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.
Which Components Can Be Injected As A Dependency In Angular Js?
Angular JS provides a supreme Dependency Injection mechanism. It provides following core components which can be injected into each other as dependencies.
1.value
2.factory
3.service
4.provider
5.constant
Is Angular Js Extensible?
Yes! In AngularJS we can create custom directive to extend AngularJS existing functionalities.
Custom directives are used in AngularJS to extend the functionality of HTML. Custom directives are defined using “directive” function. A custom directive simply replaces the element for which it is activated.
AngularJS application during bootstrap finds the matching elements and do 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.