*
Previous AngularJS-QA-3 AngularJS-QA-5 Next

AngularJS Question Answers - 4

Question: What is the purpose of the directive 'ng-class'?
Answer: ng-class: Specifies CSS classes on HTML elements.
Question: What is the purpose of the directive 'ng-class-even'?
Answer: ng-class-even: Same as ng-class, but will only take effect on even rows.
Question: How does interpolation, e.g. “{{ someModel }}”, actually work?
Answer: It relies on $interpolation, a service which is called by the compiler. It evaluates text and markup which may contain AngularJS expressions. For every interpolated expression, a “watch()” is set. $interpolation returns a function, which has a single argument, “context”. By calling that function and providing a scope as context, the expressions are “$parse()”d against that scope.
Question: What is the purpose of the directive 'ng-readonly'?
Answer: ng-readonly: Specifies the readonly attribute of an element.
Question: How to implement routing in AngularJS?
Answer: It is a five-step process:

Step 1: – Add the “Angular-route.js” file to your view.
Step 2: – Inject “ngroute” functionality while creating Angular app object.
Step 3: – Configure the route provider.
Step 4: – Define hyperlinks.
Step 5: – Define sections where to load the view.
Question: Is it a good or bad practice to use AngularJS together with jQuery?
Answer: It is definitely a bad practice. We need to stay away from jQuery and try to realize the solution with an AngularJS approach. jQuery takes a traditional imperative approach to manipulating the DOM, and in an imperative approach, it is up to the programmer to express the individual steps leading up to the desired outcome.
Question: What is the purpose of the directive 'ng-non-blindable'?
Answer: ng-non-blindable: Specifies that no data binding can happen in this element, or it's children.
Question: What is the purpose of angular.element()
Answer: It wraps an HTML element as an jQuery element.
Question: Explain what is link in Angular.js?
Answer: Link: It is used for registering DOM listeners as well as instance DOM manipulation. It is executed once the template has been cloned.
Question: Which directive defines the root element of an application?
Answer: 'ng-app' directive defines the root element of an application.
Back to Index
Previous AngularJS-QA-3 AngularJS-QA-5 Next
*
*