When it comes to developing applications on the web, AngularJS, Google’s answer to Facebook’s React, is one of the most often used front stack frameworks. The ease with which it can also be migrated to mobile apps pretty much means that AngularJS is slowly becoming the people’s favourite.
However, as with all widely embraced technologies, how does one differentiate their skills and capabilities for recruiters to spot them in a herd of wannabe AngularJS programmers?
Well, the answer is simple; most recruiters ask questions – questions that are designed to test the understanding of the candidate.
Here is a list of AngularJS Interview Questions that you need to prepare for if you want to land a job as an AngularJS programmer:
1. What is data-binding in AngularJS?
Ans: Data-binding is the automatic synchronization between the model and view components in an angular app so that when the model changes, the changes get reflected in the view.
2. What are directives in AngularJS?
Ans: Directives are attributes which allow you to add specific features for your custom nodes in HTML. These won’t be rendered on the website, but they would be used by the AngularJS framework.
Ans: Angular expressions are usually bindings that are placed. Angular expressions cannot contain any control flow statements (for, while, etc). The benefit of using these expressions is that they usually are forgiving (no need for checking for null values) and are always available within the context of their scope.
4. What do you mean by Scope?
Ans: a Scope is an object that refers to the application model. It also is an execution context for expressions. Scopes are controller specific and can also be nested.
5. What are services in AngularJS?
Ans: Services are singleton objects that are instantiated only once in the app and are available for use,
“$https” service is used to make Ajax calls.
6. What are factory methods in AngularJS?
Ans: Factory methods are used for creating directives. They are invoked when the compiler matches the directive for the first time. We could invoke the factory method using “$injector.invoke”.
7. Does Angular work on top of the jQuery library?
Ans: Yes, AngularJS can work with jQuery. However, it is not packaged by default with the framework. If it is available, it will work with jQuery, if not, then it will fall back on its own implementation called jQLite.
8. What is the importance of the ng-app directive?
Ans: The first ng-app found in the source will be used to define the root element. Around this element, the application will be loaded. AngularJS will ignore any other ng-app directive and if there are any other apps in the same source, they would have to manually bootstrapped.
9. How does a Single Page App work in AngularJS?
Ans: A Single Page app is web apps that load on a single HTML file. The content shown in that file is dynamically updated via different routes in AngularJS. The page is never reloaded and is never refreshed. This lack of round trip for the page makes it somewhat faster for the user.
10. What are the disadvantages of AngularJS?
11. What are the differences between a Service, Provider and Factory in AngularJS?
Ans: When you’re using a Factory, you create an object, add properties to it, then return that same object. When you pass this factory into your controller, those properties on the object will now be available in that controller through your factory.
When you’re using Service, AngularJS instantiates it behind the scenes with the ‘new’ keyword. Because of that, you’ll add properties to ‘this’ and the service will return ‘this’. When you pass the service into your controller, those properties on ‘this’ will now be available on that controller through your service.
Providers are the only service you can pass into your .config() function. Use a provider when you want to provide module-wide configuration for your service object before making it available.
12. How do I access the $scope variable in browser’s console using AngularJS?
Ans: Select an Element, do Inspect and in the console, type – angular.element($0).scope()
13. What is MVC?
Ans: Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts:
Model − It is the lowest level of the pattern responsible for maintaining data and the data structures.
View − It is responsible for displaying all or a portion of the data to the user. This also contains information about the interface.
Controller − It is a software code that controls the interactions between the Model and View and how the data flows from one to the other.
14. What is a promise?
Ans: ‘Promises’ are post-processing logics which are executed after some operation/action is completed. If a function is returning a promise, then the runtime can move on to the next line and handle the promise separately as and when it is fulfilled.
15. What is deep linking?
Ans: Deep linking allows the developer to encode the state of the application in the URL so that it can be bookmarked and saved for later use. Deep linking also allows the application to send the targeted communication to the user to direct their attention to specific sections within the application.