Angular Basic Interview Questions and Answers
What is Angular JS?
What are the advantages of using Angular JS?
- Modular Structure based on MVC.
- Real-time one-way and two-way data binding and DOM manipulation.
- Reusable components
- Inbuilt form validation rules
What are the main features of Angular JS?
- Seamless rendering
- MVC Structure
- Suitable for One-page application
- Supports Cache
- Service Worker Support
- Tree Shaking
What is Template?
Templates are the view part of MVC and HTML document containing directives, element, and attributes. A template is used to display results on browsers.
What is a controller?
A controller is an Object, defined by object constructor as per Angular 2.
What sre the directives in Angular JS?
Directives are the html attributes for angular. Attributes prefixed by “ng-” and used to extend scope of dom.
What is difference between jQuery and Angular JS?
What are the modules in Angular JS?
A module in AngularJS is a packet having different necessary items in it like controller, filters, directives,services.
What is data Binding?
Data binding is the key feature of Angular and many such frameworks. Data binding refers to the synchronization of information.Value stored in variables reflect at the places where are used within no time and without change of frame.There are two types of data binding-
(1)One way data binding
(2)Two way data binding
What is one-way bindings?
One way data binding is the synchronization from Modal to View. When there is a change in Model it reflects in View and in forms. But unable to change the value in model when changes happens in view after user input.
What is two-way bindings?
Two way binding is the bi-direction syncing of data. This reflects the data either side when changes occur. Changes in model lead to reflection in View and Changes in view reflects in Modal.
What is component?
Components are the basic building blocks in applications. They are completed with MVC sub components. They handle data, render views and accept user inputs.
What is provider?
As per https://docs.angularjs.org
A provider is an object with a $get() method. The injector calls the $get method to create a new instance of a service. The Provider can have additional methods which would allow for configuration of the provider.$provide is used to create new providers.
What is link?
Angular JS has a directive link on which link function is based.We can define directive’s API using these function.
What is factory method?
A factory is a function which returns any object.They are reusable singleton objects and can be used as injections.We can create using factory.
What do you mean by ng-app,ng-init,ng-model?
ng-app : this is the fundamental directive to create an Angular JS Application.
ng-init : initialize the application and data
ng-model : define the model to be used in application.
Can we use jQuery library in Angular JS?
Yes , we can use jQuery and many other library along with Angular JS.
What do you understand by deep linking?
Deep linking is the redirection to the specific page without going through any other pages.This is normal term and implemented by Angular JS by default.
What is a service?
Services are substitutable objects can be used to organize and share code across the application.
What is internationalization?
As per https://docs.angularjs.org :
Internationalization (i18n) is the process of developing products in such a way that they can be localized for languages and cultures easily.This is the translation of application interfaces according to any locale.
What is Injector in Angular JS?
Injector is a subsytem in Angular JS which provide reusable component, dependency management making them available on request.
How can we share data between controllers?
Can move data by return a factory and by using the a reference of the same object by other controller.
What is digest cycle?
Digest Cycle allow us to write custom and complex directives for data binding processes.
What is singleton pattern and where we can find it in Angular JS?
Singleton is a static variable and hold private instances of itself.It allows only a single instance to be created.
What is interceptor?
Interceptor is used to modify the response. It only calls after the http response received.It accepts response object as an input
What is routing?
We use ngRoute to implement routing.Routing helps us to modularize our application based on logical units.
What does ‘ng-serve’ do?
The ng serve command launches the server, watches your files, and rebuilds the app as you make changes to those files.
what does –open or -o command do in angular?
The –open (or just -o) command automatically opens your browser to http://localhost:4200/.
How can we create a component using Angular CLI?
Using CLI we can create component in a very less time:
| ng generate component heroes |