What are expressions in AngularJS?Angular expressions are unit of code which resolves to value. This code is written inside curly braces “{“.AngularJS expressions are much like JavaScript expressions: They can contain literals, operators, and variables.

Example {{ 5 + 5 }} or {{ firstName + " " + lastName }}

<div ng-app="">

<p>My first expression: {{ 5 + 5 }}</p>

</div>

The below expression displays a controller scoped variable.

<div ng-controller="CustomerVM">

The value of Customer code is {{CustomerCode}}

</div>

Difference between AngularJS Expressions and JavaScript ExpressionsLike JavaScript expressions, AngularJS expressions can contain literals, operators, and variables.Unlike JavaScript expressions, AngularJS expressions can be written inside HTML.AngularJS expressions do not support conditionals, loops, and exceptions, while JavaScript expressions do.AngularJS expressions support filters, while JavaScript expressions do not.What is the digest cycle, watchers and dirty checking?Digest cycle: - It is a simple loop which updates the model and view.Watchers :- They are listeners which are attached to expression and angular directives and fire when the model data changes.Dirty check :- This is a extra digest loop which runs to check any cascading left over updates due to the first digest cycle.Lets look in details.Angular is a MVW framework. It helps us to bind the model and the view. In other words when any change happens in the model the view gets updated. This updation of the model and the view is done by a loop called as digest cycle.Digest cycle follows four important steps:-Step 1:- Some kind of event is triggered by the end user like typing (onchange), button click etc and due to this activity model value changes.Step 2:- Angular first checks if the new value and old values are same. If they are same he does not do anything. If they are not it then it invokes the digest cycle.Step 3:- Digest cycle then runs through the scope objects to check which objects are getting affected because of this change. Every object in the scope have watchers. Watchers as the name says it listens whether the model has changed or not. Digest cycle informs the watchers about the model change and then watchers synchronize the view with the model data.Step 4 :- In step 3 watchers update the view and due that update its very much possible that the model changes again. Now due to this model change we have to reevaulate the view again. So the digest loop runs once again to ensure that all things are synched up. This second loop which runs is termed as dirty check loop.Below is the figure where in we have highlighted all the four steps.

How do you reset a “$timeout”, and disable a “$watch()”?The key to both is assigning the result of the function to a variable.To cleanup the timeout, just “.cancel()” it:

List at least three ways to communicate between modules of your application using core AngularJS functionality.Common ways to communicate between modules of your application using core AngularJS functionality include:Using servicesUsing eventsBy assigning models on $rootScopeDirectly between controllers, using $parent, $$childHead, $$nextSibling, etc.Directly between controllers, using ControllerAs, or other forms of inheritanceDo I need Jquery for AngularJS?No , you do not need Jquery for Angular. It’s independent of Jquery.How is the data binding in AngularJS ?Its two way binding. So whenever you make changes in one entity the other entity also gets updated.Mention what are the styling form that ngModel adds to CSS classes ?ngModel adds these CSS classes to allow styling of form as well as controlng- validng- invalidng-pristineng-dirtyDifference between angular-route and angular-ui-routerSee below descriptionExplain AngularJS boot process.When the page is loaded in the browser, 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. Once 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 the Singl Page Application (SPA)Single Page Application is one in which we have a shell page and we can load multiple views into that.Traditional application, as you know you typically blink and load everything again. It’s not very efficient on the bandwidth, especially in the mobile world.In a SPA we can load the initial content upfront and then the different views or the little kind of miniweb pages can be loaded on the fly and embedded into the shell.What is AngularJS?AngularJS is a javascript framework used for creating single web page applications. AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you would otherwise have to write.Explain Directives in AngularJSDirectives are attributes decorated on the HTML elements. All directives start with the word “ng”. As the name says directive it directs Angular what to do.For example below is a simple “ng-model” directive which tells angular that the HTML textbox “txtAgentName” has to be binded with the “AgentName” property.<input type=text id="txtAgentName" ng-model="AgentName"/>Some of the most commonly used directives are ng-app,ng-controller and ng-repeat.List out Main Features of AngularJS.

Data-bindingIt is the automatic synchronization of data between model and view components.

ScopeThese are objects that refer to the model. They act as a glue between controller and view

ServicesAngularJS come with several built-in services for example $http to make a XMLHttpRequests. These are singleton objects which are instantiated only once in app.

ControllerThese are JavaScript functions that are bound to a particular scope.

Filters These select a subset of items from an array and returns a new array.

Directives 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 (ngBind, ngModel...)

Templates These 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"

Routing It is concept of switching views.

Deep Linking 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.

Dependency Injection AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test

What are controllers and need of ng-controller and ng-model in AngularJS?Controllers are simple javascript function which provides data and logic to HTML UI.As the name says controller they control how data flows from the server to HTML UI.For example below is simple “Customer” controller which provides data via “CustomerName” and “CustomerCode” property and Add/ Update logic to save the data to database.

“ng-controller” is a directive.Controllers are attached to the HTML UI by using the “ng-controller” directive tag and the properties of the controller are attached by using “ng-model” directive. For example below is a simple HTML UI which is attached to the “Customer” controller via the “ng-controller” directive and the properties are binded using “ng-model” directive.

What is $scope in AngularJS?'$scope' is an object instance of a controller. '$scope' object instance get’s created when 'ng-controller' directive is encountered.Every controller has an associated $scope objectA controller (constructor) function is responsible for setting model properties and functions. This can be done only through $scope. Whatever function or model you apply in View (html file), that is accessed in controller using scope.Only methods defined on this $scope object are accessible from the HTML/view. Example - from ng-click, filters, etc.Now See the below examples –

function MyController($scope) { $scope.username = 'World'; };

In the above example we are defining any attribute named username with its value as “World”. Suppose in the html file you have the following line of code –

<div ng-controller="MyController"><h1>{{data.username}}</h1></div>

This will automatically pick up the value from controller and display it on screen.Now see below example

This is a function defined in a controller which you can access in view by following code –

<div ng-controller="MyController"><h1>{{data.greeting}}</h1></div>

Here, data.greeting will automatically pick value from sayHello function i.e. the value displayed will be "Hello World". "World" from username concatenated with “Hello” before.What is the ng-app directive in AngularJSng-app directive starts an AngularJS Application. It defines the root element. It automatically initializes or bootstraps the application when web page containing AngularJS Application is loaded. It is also used to load various AngularJS modules in AngularJS Application. In following example, we've defined a default AngularJS application using ng-app attribute of a div element.

<div ng-app=""></div>

What is the ng-init in AngularJS ng-init directive initializes an AngularJS Application data. It is used to put values to the variables to be used in the application.In following example, we'll initialize an array of countries. We're using JSON syntax to define array of countries.