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. 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.

Recent Posts

Agentic Reasoning Design Patterns in AI: Examples

In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…

2 months ago

LLMs for Adaptive Learning & Personalized Education

Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…

2 months ago

Sparse Mixture of Experts (MoE) Models: Examples

With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…

3 months ago

Anxiety Disorder Detection & Machine Learning Techniques

Anxiety is a common mental health condition that affects millions of people around the world.…

3 months ago

Confounder Features & Machine Learning Models: Examples

In machine learning, confounder features or variables can significantly affect the accuracy and validity of…

3 months ago

Credit Card Fraud Detection & Machine Learning

Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…

3 months ago