Top 10 AngularJS Interview Questions & Answers


1) 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
2) Explain what are the key features of AngularJS?
The key features of AngularJS are
Scope
Controller
Model
View
Services
Data Binding
Directives
Filters
Testable
3) Explain what is 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.
4) Explain what is 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, directive, filters and so on.
5) Explain what is Angular Expression? Explain what is the key difference between angular expressions and JavaScript expressions?
Like JavaScript, Angular expressions are code snippets that are usually placed in binding such as {{ expression }}
The key difference between the JavaScript expressions and Angular expressions
Context: In Angular, the expressions are evaluated against a scope object, while the Javascript expressions are evaluated against the global window
Forgiving: In Angular expression evaluation is forgiving to null and undefined, while in Javascript undefined properties generate TypeError or ReferenceError
No Control Flow Statements: Loops, conditionals or exceptions cannot be used in an angular expression
Filters: To format data before displaying it you can use filters
6) With options on page load how you can initialize a select box?
You can initialize a select box with options on page load by using ng-init directive
<div ng-controller = ” apps/dashboard/account ” ng-switch
On = “! ! accounts” ng-init = ” loadData ( ) “>
7) Explain what are directives ? Mention some of the most commonly used directives in AngularJS application ?
A directive is something that introduces new syntax, they are like markers on the DOM element which attaches a special behavior to it. In an AngularJS application, directives are the most important components.
8) 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
9) Explain what Angular JS routes do?
Angular js routes enable you to create different URLs for different content in your application. Different URLs for different content enables the user to bookmark URLs to specific content. Each such bookmarkable URL in AngularJS is called a route
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
10) Explain what is data binding in AngularJS?
Automatic synchronization of data between the model and view components is referred to as data binding in AngularJS. There are two ways for data binding
Data mining in classical template systems
Data binding in angular templates

Leave a Reply