Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 4 fuera de 134 páginas
Resumen

Summary Full information about angular js

Document preview thumbnail
Vista previa 4 fuera de 134 páginas

When we talk about standard HTML and CSS, they build static (stationary) websites. If we want our "IoT Dashboard" example to be fast, interactive, and operate in real-time, that is where Angular comes into play. ​Angular (developed by Google) is a Frontend Web Framework. It combines HTML, CSS, and code to create web applications that run as smoothly and quickly as native mobile apps

Vista previa del contenido

1




Learn Angular
Angular Setup & Config
1. The first version of Angular is called AngularJS. After that, it is referred to
simply as Angular.
2. Typescript provides errors and warnings during compile time that are easier to
understand. Typescript is a superset of Javascript.
3. Install Angular with npm → npm install -g @angular/cli@latest
4. Creating app → ng new my-app
5. Create app in existing directory → ng new existingDir --directory ./
6. Run app → ng serve


Project Setup using Bootstrap for Styling
1. Run the command - npm install –save bootstrap
2. Add the Bootstrap reference link to the styles array under the `architect>build`
section of the angular.json file.
Link → "node_modules/bootstrap/dist/css/bootstrap.min.css"


Lifecycle Method
1. OnChanges(): Called after a bound input property changes. 'Bound' means
properties decorated with @Input(). It receives arguments and is also invoked
when a component is initialized.
2. OnInit(): Called once the component is initialized and will run after the
constructor. It used to perform a custom change detection & responding to the
changes in a component.
3. DoCheck(): Called during every change detection run and will be executed
frequently.
4. AfterContentInit(): Called after content (ng-content) has been projected into
view.




S M HEMEL
Senior Software Engineer
Email:

, 2




5. AfterContentChecked(): Called every time the projected content has been
checked.
6. AfterViewInit(): Called after the component’s view (with child views) has been
initialized.
7. AfterViewChecked(): Called every time the view (with child view) has been
checked.
8. OnDestroy(): Called once the component is destroyed.




Angular Basics
Component
1. It is best practice to create all components in the 'src' directory, and each
component should have its own dedicated directory.
2. If we create a component manually, we need to create three different files.
(e.g. xyz.component.ts, xyz.component.html, xyz.component.scss)
3. General Structure of a Component(demo.component.ts) →




S M HEMEL
Senior Software Engineer
Email:

, 3




----------------------- demo.component.ts -----------------------
import { Component } from '@angular/core';
@Component({
selector: 'app-demo',
// template: '<p>Hello</p>' // We can write HTML code here
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss'],
// styles: [`h3{color: white}`] // We can write CSS code here
})
export class DemoComponent {}


[Note: We cannot use `template` and `templateUrl` simultaneously; the same rule
applies to `styles` and `styleUrls`.]

4. To use a component in a project, ensure that it is added to the declarations
array in either the app.module.ts file or a dedicated module.ts file.
5. Create a component using CLI command →
ng generate component component_name
Shortly, → ng g c component_name
Note: All components will be created inside the app directory.
6. When creating a component using the CLI command, add --skip-tests true
to avoid generating the test file.
7. An Angular component has three types of selectors. Component use in HTML
by the help of selector.
CSS Selector → selector: 'app-xyz'
<app-xyz></app-xyz>

Attribute Selector → selector: '[app-xyz]'
<div app-xyz></div>

Select by Class → selector: '.app-xyz'
<div class="app-xyz"></div>



Data Binding
1. String interpolation → {{data}}
<p>{{ 'Server' }} with ID {{ severId }} is {{ getServerStatus() }}</p>

2. Property binding → [property]=”data”


S M HEMEL
Senior Software Engineer
Email:

, 4




<button class="btn btn-primary" [disabled]="allowServer"></button>
<p [innerText]="allowServer"></p>

3. Event binding → (event)=”demoFunction()”
<button [disabled]="allowServer" (click)="onCreateServer()"></button>
<p>{{ serverCreationStatus }}</p>

4. To enable two-way binding, the ngModel directive must be enabled by adding
FormsModule to the imports array in the app.module.ts file.
<input type="text" class="form-control" [(ngModel)]="serverName" />
<p>{{ serverName }}</p>

5. Triggering an event from another component is called Custom Events binding →
----------------------- app.component.html ----------------------
<div class="container">
<app-demo
(serverCreated)="onServerAdded($event)"
(blueprintCreated)="OnblueprintCreated($event)">
</app-demo>
</div>
------------------------ app.component.ts -----------------------
export class AppComponent {
onServerAdded(serverData: {name: string, content: string}) {}
onblueprintAdded(serverData: {name: string, content: string}) {}
}
----------------------- demo.component.ts -----------------------
export class DemoComponent {
@Output() serverCreated = new EventEmitter<data_type>();
@Output() blueprintCreated = new EventEmitter<data_type>();
// Added parenthesis end of the event emitter to call its constructor to create a new
event emitter object which is stored in the serverCreated and blueprintCreated.
onAddedServer() {
this.serverCreated.emit({ name: "", content: "" });
}
}


[Note: Add parentheses at the end of EventEmitter to call its constructor and create a
new EventEmitter object, which is now stored in the serverCreated and
blueprintCreated variables.]




S M HEMEL
Senior Software Engineer
Email:

Información del documento

Subido en
13 de agosto de 2026
Número de páginas
134
Escrito en
2026/2027
Tipo
Resumen
$10.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
16
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes