AngularJS Interview Questions
A list of top frequently asked AngularJS interview questions and answers are given below.
1) What is AngularJS?
Ans. AngularJS is a JavaScript framework i.e. used to create single web page application. It follows MVC (Model View Controller) pattern. It is open source, cross browser compliant and easy to maintain.
2) What are the advantages of AngularJS?
Ans. Main advantages of AngularJS is:
1. open source
2. built by Google
3. allows us to create single page application
4. follows MVC pattern
5. predefined form validations
6. supports two way data binding
7. cross browser compliant
8. code are unit testable
3) What are the disadvantages of AngularJS?
2 main disadvantages of AngularJS are:
1. JavaScript Dependent: If end user disables JavaScript, AngularJS will not work.
2. Not Secured: It is JavaScript based framework so it is not safe to authenticate user through AngularJS only.
4) Is AngularJS dependent on JQuery?
No.
5) What are the features of AngularJS?
Some important feature are:
1. MVC
2. Validations
3. Modules
4. Directives
5. Templates
6. Scope
7. Expressions
8. Data Binding
9. Filters
10. Services
11. Routing
6. What are directives in AngularJS?
Ans. AngularJS facilitates you to extend HTML with new attributes. These attributes are called directives. All AngularJS directives start with the word "ng". There are many in-built directives in AngularJS such as "ng-app", "ng-model", "ng-controller", "ng-repeat" etc.
7. What are controllers in AngularJS?
Ans. Controllers are JavaScript functions that are used to provide data and logic to HTML UI. It acts as an interface between Model and HTML UI.
8. What are the usage of controllers in AngularJS?
Ans. AngularJS Controllers are used to: Set up initial state of the $scope object, and Add behavior to the $scope object.
9. What are expressions in AngularJS?
Ans. Expressions are the code snippets that resolves to a value. AngularJS expressions are placed inside {{expression}}. For example: {{1+1}}
10. What is data binding in AngularJS?
Ans. Data Binding is the automatic synchronization of data between model and view. There are two ways of data binding:
1. One way data binding (used in classical template)
2. Two way data binding (used in AngularJS template)
11. What are services in AngularJS?
Ans. Services are objects that can be used to store and share data across the application. AngularJS offers many built-in services such as $http, $location, $timeout, $interval etc.
12. What is scope in AngularJS?
Ans. Scope is an object that represents application model. Each AngularJS application can have only one root scope but can have multiple child scopes.
13. What is the use of filter in AngularJS?
Ans. A filter is used to format the value of expression to display the formatted output.
14. What is template in AngularJS?
Ans. A template consists of HTML, CSS and AngularJS directives that are used to render dynamic view.