> Angular 2 the key concepts
> [Workshop] Coding Dojo
Web apps
Mobile
web apps
Native apps
Desktop apps
Application
Navbar
Search
Carousel
Product
Application
// my-roor-app.component.ts
import {Component} from '@angular/core';
@Component({
selector: 'my-root-app',
templateUrl: './my-root-app.component.html',
})
class Application { /* ... */ }
<!-- index.html -->
<my-root-app>Your application is loading...</my-root-app>
<div> Hello {{ name }} </div>
<img [src]="imageUrl" />
<button (click)="doIt()"></button>
<input [(ngModel)]="name" />
<div [ngStyle]="setStyles()">
<p *ngFor="let player of players">...</p>
</div>
<p>
The chained mario's birthday is
{{ birthday | date:'fullDate' | uppercase}}
</p>
UpperCasePipe
LowerCasePipe
CurrencyPipe
PercentPipe
DatePipe
...
Service is a class that encapsulates some sort of functionality and provides it as a service for the rest of the application.
export class UserService {
private users: User[] = [];
constructor(
private backend: BackendService,
private logger: Logger
) { ... }
getAllUSers() {
return this.users;
}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
imports: [ BrowserModule ],
providers: [ Logger ],
declarations: [ AppComponent ],
exports: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);