Manual Backend Angular PHP PDF
Manual Backend Angular PHP PDF
https://nodejs.org/en/
TypeScript
Angular uses TypeScript as its main programming language ( at least 2.1 )
$ ng new
$ ng generate
$ ng serve
Dev Environment
IDEs that can support our Angular development.
Angular Concepts
Contents
- Architecture Overview
- Modules
- Components
- Templates
- Metadata
- Data binding
- Directives
- Services
- Dependency injection
Architecture Overview
Modules
Angular apps are modular and Angular has its own modularity system called
Angular modules or NgModules. They help organize an application into cohesive
blocks of functionality.
https://angular.io/docs/ts/latest/guide/ngmodule.html
Modules
Properties of an NgModule:
templates.
- Bootstrap: Main application view (root component), that hosts all app views.
Components
Angular applications are made up of components. A component is the combination
of an HTML template and a component class that controls a portion of the screen.
Components
import { Component } from '@angular/core'
@Component({
selector: 'example',
template: `
<h1>Example Component</h1>
`
})
of HTML that tells Angular how to render the component. A template looks like
@Component({
selector: 'hero-list',
templateUrl: './hero-list.component.html',
providers: [ HeroService ]
})
Data binding
Angular supports data binding. A mechanism for coordinating parts of a template
with parts of a component.
Data binding
Angular supports data binding. A mechanism for coordinating parts of a template
with parts of a component.
<input [(ngModel)]="hero.name">
Services
A service is typically a class with a narrow, well-defined purpose. It should do
something specific and do it well.
- Logging service
- Data service
- Message bus
- Application configuration
Services
A service is typically a class with a narrow, well-defined purpose. It should do
something specific and do it well.
@Injectable()
export class ExampleService {
constructor() { }
}
Dependency Injection
Dependency injection is a way to supply a new instance of a class with the
fully-formed dependencies it requires. Most dependencies are services. Angular
uses dependency injection to provide new components with the services they
need.
Angular can tell which services a component needs by looking at the types of its
constructor parameters.
Dependency Injection
Cross-platform usages
Ionic
● Free & Open Source.
● Fully Cross-Platform.
● Premier Native Plugins.
● First-class Documentation.
NgModules: https://angular.io/docs/ts/latest/guide/ngmodule.html
NodeJS: https://nodejs.org/en/
Typescript: https://www.typescriptlang.org/docs/tutorial.html
Cordova: https://cordova.apache.org/#getstarted
NativeScript: http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Augury: https://augury.angular.io/
VSCode: https://code.visualstudio.com/
http://github.com/cbelda/ng-material-starter.git
@NgModule({
...
imports: [BrowserAnimationsModule],
...
})
export class AppModule { }
Paso 1: Preparación del entorno
@import '~@angular/material/theming';
@include mat-core();
@include angular-material-theme($theme);
Paso 1: Preparación del entorno
Añadir módulos básicos al NgModule
import {MatButtonModule, MatCheckboxModule} from '@angular/platform-browser/animations';
@NgModule({
...
imports: [MatButtonModule, MatCheckboxModule],
...
})
export class AppModule { }
Paso 2: Añadir componente
El Angular CLI tiene una API con la que podemos generar componentes, servicios,
clases etc. para nuestro proyecto:
https://material.angular.io/components/card/examples
<mat-card class="example-card">
<mat-card-header>
<img mat-card-avatar class="example-header-image"src="https://material.angular.io/assets/img/examples/shiba2.jpg">
<mat-card-title>Shiba Inu</mat-card-title>
<mat-card-subtitle>Dog Breed</mat-card-subtitle>
</mat-card-header>
<img mat-card-image src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu">
<mat-card-content>
<p>
blablabla...
</p>
</mat-card-content>
<mat-card-actions>
<button mat-button>LIKE</button>
<button mat-button>SHARE</button>
</mat-card-actions>
</mat-card>
Paso 3: Añadir componente “complejo”
El Angular CLI tiene una API con la que podemos generar componentes, servicios,
clases etc. para nuestro proyecto: