AngularJS Interview Questions
Suggested read: Excel Interview Questions
What are the directives and its types?
These are the special markers that communicate with HTML compiler and tell the compiler to attach specified behavior to DOM. Take a look at inbuilt directives like ngClass, ngRepeat, ngBind, ngApp. and nglnit. There are 4 types of directives available:
- Attribute directive
- Element directives
- CSS class directives
- Comment directives
- It evaluates expressions against scope object.
- The evaluation of an angular expression is forgiving either to null or undefined.
- Can’t use loops, conditionals, or exceptions
- Filters are there to format data before publishing it.
- Evaluate expressions against the global window
- The undefined and null properties show TypeError or ReferenceError.
- Can use loops, exceptions, or conditionals
- Filters to format data are not available
Suggested read: SQL Interview Questions
It is a service locator that retrieve an instance of objects which are defined by instantiate types, provider, load modules, and invoke methods.
Why have you chosen AngularJS instead of another framework?
The AngularJS is extended HTML that results from an expressive, quick to develop, and readable environment.
Benefits of AngularJS:
- The AngularJS is the REST-friendly.
- It has the support of dependency injection.
- It offers data-binding, routing supports, inbuilt services, and form validations.
- It extends HTML via expression, directives, and data binding techniques.
- MVC implementation.
Name browsers that are compatible with AngularJS?
Define $rootscope in AngularJS?
Scope provides the separation between the model and view. It offers event emission, broadcast, and subscription facility. Every application has its own single root scope.
What is bootstrapping?
The bootstrapping is the initialization or starting of an Angular app. There are two types of angularJS available with name automatic and manual bootstrapping.
Manual bootstrapping: With this, you have full control over how and when you should initialize your angular app.
Automatic bootstrapping: For automatic bootstrapping, you need to add a directive to the root, if you want to bootstrap automatically. Whenever the angularJS finds ng-app directive, it automatically loads the module attached with it and compiles DOM.
What is ng-controller, ng-app, ng-class?
Ng-controller: It attaches the controller class with a view.
Ng-app: It initializes the application.
Ng-Class: It is used to assign CSS class.
It is a medium by which you can display the locale information on your site. The programmers use this feature to create multiple language websites.
What are the basic steps to set Angular App?
- Firstly, you need to create an angular module
- Then assign a controller to the angular module.
- Connect your angular module with HTML using ng-app.
- With ng-controller directive, you have to link controller to HTML.
Practice these AngularJS Interview Questions and get selected for your dream job.