Angular Flashcards

1
Q

What is the class that Angular provides to make http requests?

A

HttpClient

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which is the packaga that contains the class HttpClient?

A

@angular/common/http

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which is the interface over HttpClient relies?

A

XMLHttpRequest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the basic building blocks of Angular?

A

Angular components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are Angular NgModules?

A

NgModules contain Angular Components. They collect related code into functional sets. An application always has at least a root module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

They define views, which are sets of screen elements that Angular can choose among and modify according to your program logic and data

A

Components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

They can be injected into components as dependencies, making your code modular, reusable, and efficient.

A

Service Providers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are services?

A

They are for data or logic that isn’t associated with a specific view, and that you want to share across components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is injection decorator for?

A

The decorator provides the metadata that allows other providers to be injected as dependencies into your class. A service class definition is immediately preceded by the @Injectable() decorator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is Dependency injection (DI) for?

A

Dependency injection (DI) lets you keep your component classes lean and efficient. They don’t fetch data from the server, validate user input, or log directly to the console; they delegate such tasks to services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Que es un decorador?

A

Un decorador agrega metadata a un componente, como por ejemplo la plantilla que debe quedar asociada.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

List some Angular decorators

A

@Component()
@Directive()
@Pipe()
@Injectable()
@NgModule()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List the forms of Angular Binding

A

Interpolation
Property binding
Event binding
Attribute binding
Class and style binding
Two-way data binding with ngModel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Cómo se inicia un proyecto Angular?

A

npm install -g @angular/cli
ng new <my-app></my-app>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Cómo se ejecuta un proyecto Angular?

A

Navegar hasta la carpeta de la aplicación
ejecutar: “ng serve - - open”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Que signfica el prefijo ng en las directivas Angular?

A

ng funciona cómo apreviatura para Angular, mas que quedo desde el punto de vista de la pronunciación. También pudo haber sido pensado como ng = new generation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Que elementos se configuran al usar “ng new”?

A

Angular routing
Style format como CSS, SCSS, SASS o LESS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Que es un Angular View?

A

Está definida por un componente y su plantilla.

19
Q

Donde estan ubicados los modulos?

A

En la carpeta node_modules

20
Q

Comando para compilar para producción

A

ng build

21
Q

Comando para ejecutar con pruebas

A

ng test

22
Q

Que significa PWA?

A

Progressive web application

23
Q

Que es Angular Material?

A

Es una biblioteca de componentes preconstruidos para trabajar interfaces de usuario con Angular.

24
Q

Cómo se agrega Angular Material a un proyecto?

A

ng add @angular/material

25
Q

Que elementos adicionales componentes proporciona Angular Material?

A

Temas, tipografias y animaciones.

26
Q

Cómo agregar archivos con variables de entorno en anuglar?

A

$ ng generate environments

27
Q

De un ejemplo de template expressions

A

<h3>Current customer: {{ currentCustomer }}</h3>

<img [src]=”urlImagen + ‘?t=’ + timeStamp”>

28
Q

De un ejemplo de template statements

A

<button type=”button” (click)=”deleteHero()”>Delete hero</button>

29
Q

Cómo se agrega un componente usando angular CLI?

A

ng generate component xyz

30
Q

Cómo se configuran las rutas en Angular?

A
  • $ ng generate component <mi-componente></mi-componente>
  • Se deben agregar los nuevos componentes al elemento declarations en el archivo app.module.ts
  • Se deben agregar los paths al array de rutas en el archivo app-routing.module.ts
31
Q

Cuales son los tres tipos de directivas?

A

Attribute Directives

  • Component
  • Structural Directives
  • Attribute Directives
32
Q

Mencione dos directivas estructurales comunes

A

*ngIf, *ngFor

33
Q

De un ejemplo de el uso de la directiva *ngIf

A

@Component({
selector: ‘app-notification’,
template: <div *ngIf = ‘showNotif’> Show Notification </div>
})
export class AppNotificationComponent {
showNotif = true;
}

34
Q

En que año sale Angular 2?

A

2016

35
Q

De un ejemplo de el uso de una directiva de atributo

A

import { Directive, ElementRef } from ‘@angular/core’;

@Directive({
selector: ‘[appHighlight]’
})
export class HighlightDirective {
constructor(private el: ElementRef) {
this.el.nativeElement.style.backgroundColor = ‘yellow’;
}
}
/*****/

<p>This is invalid</p>

36
Q

¿Cómo se crea un servicio?

A

ng generate service hero

37
Q

Why services?

A

Components shouldn’t fetch or save data directly and they certainly shouldn’t knowingly present fake data. They should focus on presenting data and delegate data access to a service.

38
Q

What is @input() decorator for?

A

It is for passing properties from parent to childs.

39
Q

Show an example of @input() decorator use

A

import { Component, Input } from ‘@angular/core’;
export class ItemDetailComponent {
@Input() item = ‘’;
}
/* From parent */
<app-item-detail [item]=”currentItem”></app-item-detail>

40
Q

How can we watch for changes on an @input() property?

A

We can watch them through OnChanges lifecycle hook.

41
Q

What is @OutPut() decorator for?

A

The @Output() decorator in a child component or directive lets data flow from the child to the parent.
To raise an event, an @Output() must have the type of EventEmitter

42
Q

How can we specify a template variable?

A

In the template, you use the hash symbol, #, to declare a template variable

43
Q

Give an example of template variable use

A

<input #phone placeholder=”phone number” />

44
Q

Mention some testing frameworks that could be used with Angular.

A

Jest, developed by FaceBook
Mocha, developed by T. J. Holowaychuk, ExpressJS Developer
Jasmin, BDD framework, developed by Pivotal Labs