Wednesday, October 28, 2015

AngularJS Questions and Answers

8) List out the differences between java Script and angular JS expressions?
Below are the list of differences between java script and angular JS
  • In Javascript expressions are being evaluated from the global window whereas in angularJS it is being evaluated from scope object.
  • Conditions, Loops and Exceptions are not supported in AngularJS as in Javascript.
9) Explain controller in AngularJS?
Controller is constructor function in AngularJS. Controller can be attached to DOM using “ng-controller” attribute.
10) Which and all browsers support AngularJS?
All major browsers like – Chrome, Safari, Firefox, Opera 15+, IE 9+ will support AngularJS.
11) How AngularJS is used to handle the security hurdles?
Below are the list of security hurdles handled by AngularJS –
  • Used for preventing CSS attacks
  • Used for preventing XSRF protection
  • Used for preventing HTML injection
12) Explain module in AngularJS?
Modules are like namespaces in C#. Modules are used for dividing single page angular app to functional, reusable and small components and can be integrated with another angular app. Module can be assigned using “ng-app” directive.
13) How we can use JQuery with AngularJS?
AngularJS uses JQLite, which is a part or subset of JQuery library. If JQuery to be used then load the JQuery library before loading the AngularJS library.
14) Explain how we can create module and using it in AngularJS?
Below is the code snippet for creating and using module in AngularJS –
Creating a module -
<script type="text/javascript"> 
 angular.module('myFirstApp', []); 
 angular.module('myFirstApp', ['MydependentModule1', 'MydependentModule2']); 
</script>
Using the Module –
<html ng-app="'myFirstApp'"> 
 <head> ... </head> 
 <body> ... </body>
</html>
15) Explain directive in AngularJS?
Directive are combination of javascript code and AngularJS markup. Javascript directive code defines the behaviors and template data of HTML elements. There are some built in directives like – “ng-controller”,”ng-app”, “ng-repeat” etc.

No comments: