To jest stara wersja strony!
Angular
Instalacja
Angular wymaga Node.js: https://nodejs.org/en/download/prebuilt-installer/current
Uruchamiając npm na Windows otrzymamy błąd: npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system.
Uruchomienie polecenia
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
w konsoli powinno wyeliminować problem.
Angular instalujemy następującym poleceniem w konsoli:
npm install -g @angular/cli
Nowy projekt
- Utworzenie projektu
ng new project_name
- Uruchomienie serwera deweloperskiego
W folderze głównym projektu:
npm start
Nowy komponent
ng generate component my_component
lub wersja skrócona:
ng g c my_component
Ustawienie polskiej lokalizacji
Instalacja pakietu
npm install @angular/common
Import danych lokalizacyjnych w app.module.ts
import { registerLocaleData } from '@angular/common';
import localePl from '@angular/common/locales/pl';
registerLocaleData(localePl);
Ustawienie lokalizacji w providers w app.module.ts
import { LOCALE_ID } from '@angular/core';
@NgModule({
providers: [{ provide: LOCALE_ID, useValue: 'pl-PL' }]
})
export class AppModule { }
Pipes
DatePipe
<p>{{ today | date:'fullDate' }}</p>
CurrencyPipe
<p>{{ amount | currency:'USD' }}</p>
UpperCasePipe
<p>{{ 'hello world' | uppercase }}</p>
LowerCasePipe
<p>{{ 'HELLO WORLD' | lowercase }}</p>
DecimalPipe
<p>{{ 1234.5678 | number:'1.2-2' }}</p>
PercentPipe
<p>{{ 0.1234 | percent }}</p>