AngularJS Interview Questions

5. How to implement internationalization in AngularJS?
AngularJS supports inbuilt internationalization for three types of filters currency, date and numbers. We need to incorporate corresponding js according to locale of the country. By default it handles the locale of the browser.

6. Tell me the source of communication between modules of your application are easily testable ?
Using a service is definitely easy to test. Services are injected, and in a test either a real service can be used or it can be mocked
Events can be tested.
In unit testing controllers, they usually are instantiated.
For testing events on $rootScope, it must be injected into the test.

7. Explain expressions in AngularJS?
Expressions in AngularJS are similar to JavaScript code snippets. JavaScript code is usually written inside double braces:
Angular Expressions are JavaScript code snippets with limited sub-set. Expressions are included in the HTML elements.
{{ 4 + 6 }} (numbers)
{{FirstName + ” ” + LastName}} (string)

8. What should be the maximum number of concurrent “watches”?
To save memory consumption and improve performance it is a good idea to limit the number of watches on a page to 2,000.Memory use and digest cycle performance are directly affected by the number of active watches. Therefore, it is best to keep the number of watches below 2,000. The open-source utility ng-stats gives developers insight into the number of watches Angular is managing, as well as the frequency and duration of digest cycles over time.

Comments are closed here.