AngularJS Interview Questions – Set 2

The article presents another set of 10 interview questions for you to try your understanding of AngularJS fundamentals. You may find some of them as tricky ones. Questions below primarily focus on angular application initialization process. Do note that I shall be coming up with multiple such set of questions in the near future as I swim deeper into Angular Sea. 🙂 Please feel free to suggest/comment if you disagree with any of the answers below.


Question Set

  1. Can the angular application be initialized on only HTML element or ANY element?
    Ans: ANY element
  2. Can an HTML page have multiple “ng-app” directive for bootstrapping multiple AngularJS application?
    Ans: Yes
  3. 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.
    Ans: Only 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.
  4. Describe the steps involved in bootstrapping an angular application?
    Ans: Following steps are involved in bootstrapping the angular application:
    • Determine the element consisting of ng prefixes with “app”
    • Check whethar an angular app already exists on the element
    • Compile & link with the help of dependencies such as rootScope injected (used for linking).
  5. Can angular applications (ng-app) be nested within each other?
    Ans: No
  6. What are various possible prefixes such as “ng-” using which Angular directives (for example, ng-app) can be defined?
    Ans: “ng-“, “data-ng-“, “ng:”, “x-ng-“
  7. What are various possible ways in which angular application can be initialized?
    Ans: On an element, one could either put simply the attribute such as (ng-app, data-ng-app, ng:app, x-ng-app) or put the named attribute such as (ng-app=”demoApp”).
  8. What angular function is used to manually start up an angular application?
    Ans: angular.bootstrap
  9. Can multiple angular applications be bootstrapped using same element?
    Ans: No. An error is thrown such as “App Already Bootstrapped with this Element”
  10. At framework level, how does Angular retrieve the matching elements for processing?
    Ans: Makes use of jqLite(element) function. If jQuery is used, jQuery(element) is used by way of assigning jQuery to jqLite variable.>

Do watch out this space for more AngularJS interview questions.


Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking. Check out my other blog, Revive-n-Thrive.com

Recent Posts

Feature Engineering in Machine Learning: Python Examples

Last updated: 3rd May, 2024 Have you ever wondered why some machine learning models perform…

2 days ago

Feature Selection vs Feature Extraction: Machine Learning

Last updated: 2nd May, 2024 The success of machine learning models often depends on the…

3 days ago

Model Selection by Evaluating Bias & Variance: Example

When working on a machine learning project, one of the key challenges faced by data…

3 days ago

Bias-Variance Trade-off in Machine Learning: Examples

Last updated: 1st May, 2024 The bias-variance trade-off is a fundamental concept in machine learning…

4 days ago

Mean Squared Error vs Cross Entropy Loss Function

Last updated: 1st May, 2024 As a data scientist, understanding the nuances of various cost…

4 days ago

Cross Entropy Loss Explained with Python Examples

Last updated: 1st May, 2024 In this post, you will learn the concepts related to…

4 days ago