0% found this document useful (0 votes)
2 views2 pages

Angular questions

The document discusses key components of Angular, including templates, directives, and services, highlighting their roles in creating dynamic web applications. It contrasts AngularJS and Angular, noting that Angular is based on TypeScript and utilizes components and modules. Additionally, it explains the concept of directives, including structural directives that modify the DOM structure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Angular questions

The document discusses key components of Angular, including templates, directives, and services, highlighting their roles in creating dynamic web applications. It contrasts AngularJS and Angular, noting that Angular is based on TypeScript and utilizes components and modules. Additionally, it explains the concept of directives, including structural directives that modify the DOM structure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

document.getElementById("myText").style.

fontSize = "20";

document.getElementById("myText").className = "anyclass";
The pop() method is similar as the shift() method but the difference is that
the Shift method works at the start of the array
var I = new object();

JavaScript:

TypeScript:

The other essential building blocks of Angular are:

 Templates: Templates are written in HTML and contain Angular elements and
attributes. Models provide a dynamic view to the user by combining information
from the controller and view and rendering it.
 Directives: Directives allow developers to add new HTML syntax, that is
application-specific. The behavior is essentially added to the existing DOM
elements.
 Services: Rather than calling the Http service, Angular allows for the creation of
new service classes. When new Services are created in Angular, they can be used
by different components.

 AngularJS Angular
 Based on JavaScript Based on TypeScript
 Based on the MVC design pattern Based on components, modules, and
directives

Advantage to use Angular

Suupports two-way data binding.


Supports validations and template syntax (both angular and static).
We can add custom animations, directives, and services.
The event handling process is seamless.
What Are Directives in Angular?
Answer: With directives, developers can write application-specific custom HTML
syntax.
The new language is written in the DOM, and the Angular compiler executes the
directive functions when it finds a new HTML syntax.
There are three types of directives – attribute, component, structural

Structural Directive

Structural directives change the structure of DOM. Examples, *ngIf and *ngFor.
Usage example.
<div *ngIf = “product” class=”name”>{{product.name}}</div>
Same way.
<ul> <li *ngFor = “Show product list”>{{product.name}}</li> </ul>

You might also like