Jul 13

AngularJs Interview Question Part-I

1. AngularJs Key Features
Ans. -> Following are angularjs key features
a. Model
b. View
c. Controller
d. Scope
e. Data Binding
f. Filters
g. services
h. Directive

2. What is services in AngularJs
Ans. -> Services in AngularJs are singleton object or function that are used for carying specific task. Services Belong to some business logic and function, that is called directive, controller and filters.

3. What is angularJs Expressions. Explain diffrence between angularjs expression and javascript expression.
Ans. -> angularjs expressions are code snippet that are used for data binding like {{Expression}}
a. Context :- In angularjs, the expression are evaluated against a scope object, while javascript expression evaluated against the global windows.
b. Forgiving :- In angularjs expression evalution is forgiving to null ad undefined, while in javascript undefined properties generates typeerror or referenceerror.
c. No Control Flow Statements :- Loops, conditionals of exceptions cannot be used in and angular expression.
d. Filters :- to format data before displaying it you can use filters.

4. Advantages of AngularJs.
Ans. -> angularJs has several advantages in web development.

  • AngulaJS Support MVC pattern
  • Two way data binding possible using AngularJs
  • It has per-defined form validations
  • Supports REST full services
  • supports both client server communication
  • Support dependency injection
  • Support Animation
  • Event Handlers

5. Diffrence between link and compile function in angularJs
Ans.-> Compile function is used for template DOM manipulation and to collect all the directives. Link function is used for registering DOM Listners as well as instance DOM Manipulation and is executed once the template has been cloned.

6. what is injector in angularJs?
Ans. -> An injector is a service locator, used to retrieve object instance as defied by provider, instantiate types, invoke methods and load modules.

7. what is difference between AngularJs and Backbone.Js?
Ans.->AngularJS combines the functionalities of most third party libraries and supports individual functionalities required to develop HTML5 Apps while backbone.js does these jobs individually.

8. String interpolation in AngularJs?
Ans.-> In AngularJs the compiler matches text during the compilation process and attributes using interpolate service to see contains embedded expressions.

9. Steps for the compilation process of HTML.
Ans. -> using browser API, first HTML is parsed into DOM. by using the $compile method , compilation of DOM is performed. The method traverses the DOM and matches the directives. Link the template with scope by calling the linking funtion returned from the previous step.

10. What are Controllers in AngularJS?
Ans. -> Controllers are Javascript functions wich provide data and logic to HTML UI. As the name suggests, they control how data flows from the server to HTML UI.

Jul 11

Data Binding in AngularJs

Data Binding in AngularJs is automatically synchronization of data between model and view. The view is project of model at all time. When the model changes, the view reflected changes and vice versa. Two type of data binding in angularJs.
1. One-way data-binding :- In angularJs templating systems bind data in only one direction, they merge template and model together into view. After Merge, the changes in model and related section of view are not reflated automatically in the view. Same as any change made by user in view not reflected into model. This is called one-way data binding in angularJs.


2. Two-way data-binding :- In this way any changes made by user in view immediately reflected in the model and any changes in model propagated to the view.Template in angularJs work differently, First template compile in the browser and compilation step produced a live view.


Jul 04

AngularJs Interview Question

1. What is AngularJs
Ans. -> AngularJs is framework, work on MVC pattern to build large scale and perfomance web application. it is easy to use and maintanance. AngularJs is powerful javascript library to create RICH Internate Application. AngularJs provides a way to write client side application in MVC structure. Application written in AngularJs automatically handle javascript code which is sutaible for all browser.
2. What is MVC.
Ans. -> Model view controller design pattern popular as MVC used to develop web application. Model is responsible for communicate with data, view responsible for display data to user, controller is control interaction between model and view.
3. What is controller in angularJs
Ans.-> Controller are javascript function that are bound to particular scope. It is function that operate on data and decide which view is to be updated show the model base data.
4. what are filter in angularJs
Ans. -> AngularJs filter select a subset of items from an array and return new array.Filters are used to show filtered items from a list of items based on defined criteria.
5. What is template in angularJs
Ans. -> Template are the render view with information from the controller and model. This can be single file and multiple views in one page using.
6. How can be initialize angularJs application data.
Ans. -> ng-init directive use to initialize application data in angularJs

my name is {{name}}

7. Describe core directive of angularJs
Ans. -> Following are core directive in angularJs.
a. ng-app – This directive defines and links an AngularJS application to HTML.
b. ng-model – This directive binds the values of AngularJS application data to HTML input controls.
c. ng-bind – This directive binds the AngularJS Application data to HTML tags.
8. Explain boot process in angularJs.
Ans. -> Following are the boot process in angularJs
a. First HTML document is loaded in browser and render by browser. Then AngularJs javascript file is loaded and global object created. after that javascript which register controller functions is excuted.
b. AngularJs scans through the html to look for angularJs app and view. Once view is located, it connects that view to the corresponding controller function.
c. AngularJS executes the controller functions. It then renders the views with data from the model populated by the controller. The page gets ready.
9. HTTP GET and HTTP POST Request in AngularJs
Ans. -> ‘$http’ service of angular is use for http request in angularJs. For http request we need to input ‘$http’ as parameter in function.

function Controller($scope,$http)
$scope.Add = function()
$http({ method: "GET", url: "http://localhost/test" }).success(function (data, status, headers, config)
// Here goes code after success

‘$http’ service api need following thing.
a. what kind of request requested by client ‘GET’ or ‘POST’.
b. Secure url on which action should happen.
c. we need to define ‘success’ function which will excute when response get from server.

$http({ method: "GET", url: "http://localhost/test" }).success(function (data, status, headers, config)
// Here goes code after success

Jun 26

HTTP GET and POST Request

The HTTP is communication protocol between client(Web browser) and server(Application on a computer that host a website is the server). The HTTP stand for hypertext transfer protocol. Two method used for communication between client and server that is GET and POST. GET Request communicate with server through url by sending name/value pairs query string.(for example : http://www.test.com/test.php?name=abc.

1. GET Request can be cached.
2. Never used GET request with sensitive data.
3. GET request have length restrictions because GET request send by url and url have restrictions of length, means we can send max 255 char by url.
4. It is also save in browser history.
5. GET Request can be bookmarked.
6. GET Request have restriction on data type, Only ASCII characters allowed
7. GET Request is less secure than post because data send using url. so, never send sensitive data like password and other information by GET request.
8. GET used encoding type “application/x-www-form-urlencoded”

POST method send data using http message body through query string name/value pairs.


POST /test.php HTTP 1.1
Host www.test.com

1. POST request are never cached.
2. POST request have no restriction, binary data also allowed.
3. POST request parameters are not saved in browser history.
4. POST request more secure than GET because parameter not saved in bowser history or in server logs.
5. POST used encoding type “application/x-www-form-urlencoded or multipart/form-data”. use multipart data encoding for binary data.
6. POST request have no restriction of data length.
7. POST request cann’t be bookmarked.

Some other HTTP request as follow.

1. HEAD : same as GET request but only return HTTP header and no document body.
2. PUT : Used to create a resource, or overwrite it. While you specify the resources new URL.
3. DELETE : This method used for Delete the specified request.
4. OPTIONS: Returns the HTTP methods that the server supports
5. CONNECT: Converts the request connection to a transparent TCP/IP tunnel

Older posts «