Q#1. What is Angular?
Ans. Angular is a TypeScript-based open-source web application framework, developed and maintained by Google. It offers an easy and powerful way of building front end web-based applications.
Q#2. What are the advantages of using Angular?
Ans. A few of the major advantages of using Angular framework are listed below:
It supports two-way data-binding
It follows MVC pattern architecture
It supports static template and Angular template
You can add a custom directive
It also supports RESTfull services
Validations are supported
Client and server communication is facilitated
Support for dependency injection
Has strong features like Event Handlers, Animation, etc.
Q#3. Could you explain services in Angular?
Ans. Singleton objects in Angular that get instantiated only once during the lifetime of an application are called services. An Angular service contains methods that maintain the data throughout the life of an application.
The primary intent of an Angular service is to organize as well as share business logic, models, or data and functions with various components of an Angular application.
The functions offered by an Angular service can be invoked from any Angular component, such as a controller or directive.
Q#4. What is Angular mainly used for?
Ans. Angular is typically used for the development of SPA which stands for Single Page Applications. Angular provides a set of ready-to-use modules that simplify the development of single page applications. Not only this, with features like built-in data streaming, type safety, and a modular CLI, Angular is regarded as a full-fledged web framework.
Q#5. What is string interpolation in Angular?
Ans. Also referred to as moustache syntax, string interpolation in Angular refers to a special type of syntax that makes use of template expressions in order to display the component data. These template expressions are enclosed within double curly braces i.e. {{ }}.
The JavaScript expressions that are to be executed by Angular are added within the curly braces and the corresponding output is embedded into the HTML code. Typically, these expressions are updated and registered like watches as a part of the digest cycle.
Q#6. What are templates in Angular?
Ans. Templates in Angular are written with HTML that contains Angular-specific elements and attributes. These templates are combined with information coming from the model and controller which are further rendered to provide the dynamic view to the user.
Q#7. What are directives in Angular?
Ans. Directives are one of the core features of Angular. They allow an Angular developer to write new, application-specific HTML syntax. In actual, directives are functions that are executed by the Angular compiler when the same finds them in the DOM. Directives are of three types:
Attribute Directives
Component Directives
Structural Directives
Q#8. In Angular what is string interpolation?
Ans. String interpolation in Angular is a special syntax that uses template expressions within double curly {{ }} braces for displaying the component data. It is also known as moustache syntax. The JavaScript expressions are included within the curly braces to be executed by Angular and the relative output is then embedded into the HTML code. These expressions are usually updated and registered like watches, as a part of the digest cycle.
Q#9. What is AOT (Ahead-Of-Time) Compilation?
Ans. Each Angular app gets compiled internally. The Angular compiler takes in the JS code, compiles it and then produces some JS code. This happens only once per occasion per user. It is known as AOT (Ahead-Of-Time) compilation.
Q#10. What do you understand by controllers in Angular?
Ans. Controllers are JavaScript functions which provide data and logic to HTML UI. As the name suggests, they control how data flows from the server to HTML UI.