AngularJS Interview Questions-Set1 – User friendly Tech help
Here comes our first set of Interview questions on Angular JS. Hope it assist the job aspirants to crack the interviews.
n
nDo like our Facebook page or follow on Twitter for more questions.
n
nIt is said “The end justifies the beginning” ,so begin right,prepare well for the interview and crack it.
n
n
Cracking Angular JS |
n
n1.What is AngularJS?
nAngularJS is a MVC framework used for creating single web page applications(SPA). 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. It allows to create reusable components like directives. Additionally, it has built in Unit Testing Framework
n
n2.What are the key features of AngularJS?
n
- n
- Scope
- Controller
- Model
- View
- Services
- Data Binding
- Directives
- Filters
- Testable
n
n
n
n
n
n
n
n
n
n
n3.Why AngularJS?
nhttp://www.sitepoint.com/10-reasons-use-angularjs/
n
n4.What is ng-repeat? Why we use it?
nhttps://docs.angularjs.org/api/ng/directive/ngRepeat
n
n5.Can an HTML page have multiple “ng-app” directive for bootstrapping multiple AngularJS application?
nIt is possible to have multiple ng-app directive for bootstrapping multiple AngularJS applications.
n
n6.What is purpose of directives in AngularJS? Explain lifecycle of directive?
n https://docs.angularjs.org/guide/directive
n
7.What is the significance of filters? You can apply filters in HTML or in controller, which one hits performance?
nhttps://docs.angularjs.org/api/ng/service/$filter
nApplying filters in HTML will execute the digest cycle multiple times. It is recommended to apply filters in controllers instead of having it directly in your HTML. Functionality wise both are same but the filter in the controller is faster and more performant.
n
n8.What is the difference between ng-show and ng-if ?
nThe ngShow directive shows or hides the given HTML element based on the expression provided to the ngShow attribute. The element is shown or hidden by removing or adding the ng-hide CSS class onto the element. The .ng-hide CSS class is predefined in AngularJS and sets the display style to none (using an !important flag).
nThe ngIf directive removes or recreates a portion of the DOM tree based on an expression. If the expression assigned to ngIf evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.
n
n9.What is purpose of ng-init?
nhttps://docs.angularjs.org/api/ng/directive/ngInit
n
n10.What is data-binding? Explain one-way and two-way binding with example.
nhttps://docs.angularjs.org/guide/databinding
n
n11.Can the angular application be initialized on only HTML element or ANY element?
nIt can be initialized on any element.
n
n12.With more than one ng-app in an HTML document (an HTML page), are they automatically initialized? Describe the angularJS application initialization process with multiple ng-app in an HTML document/page.
nOnly one AngularJS application can be auto-bootstrapped. The first ‘ng-app’ found in the document will be used to define the root element to auto-bootstrap as an application. To run multiple applications in an HTML document, one must manually bootstrap them using angular bootstrap service.
n
n13.What is the mechanism to share data between different controllers?
nhttps://docs.angularjs.org/guide/services
n
n14.When and where should we use angular.element?
nhttps://docs.angularjs.org/api/ng/function/angular.element
n
n15.Which angular function is used to manually start up an angular application?
nhttps://docs.angularjs.org/api/ng/function/angular.bootstrap
n
nMore interview Questions