Angular Command Line Interface: Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
Zeile 71: Zeile 71:


[https://gnomeontherun.com/2017/03/02/guards-and-login-redirects-in-angular/ https://gnomeontherun.com/2017/03/02/guards-and-login-redirects-in-angular/]
[https://gnomeontherun.com/2017/03/02/guards-and-login-redirects-in-angular/ https://gnomeontherun.com/2017/03/02/guards-and-login-redirects-in-angular/]
=== Production Build ===
<pre>
ng build --prod
</pre>
==== Links ====
[https://angular.io/guide/deployment https://angular.io/guide/deployment]
[https://angular.io/guide/deployment#fallback https://angular.io/guide/deployment#fallback]


=== Service erstellen ===
=== Service erstellen ===

Version vom 24. März 2019, 17:10 Uhr

Installation

sudo npm install -g @angular/cli

Konfiguration

Umgebungsvariable für Google Chrome (Chromium) setzen:

vi ~/.bashrc

Am Ende folgende Zeile hinzufügen:

export CHROME_BIN=/usr/bin/chromium-browser

Verwendung

Klasse erstellen

ng generate class <class name>

Komponente erstellen

ng generate component [-s] <table name>
kurz lang Bedeutung
-s --inline-style Es wird keine CSS-Datei erstellt

Modul erstellen

ng g module <module name> --routing

Projekt erstellen

ng new <project name> --prefix <prefix>

Routen erstellen

ng generate module app-routing --flat --module=app

Guard erstellen

ng g guard <guard name>

Links

https://gnomeontherun.com/2017/03/02/guards-and-login-redirects-in-angular/

Production Build

ng build --prod

Links

https://angular.io/guide/deployment

https://angular.io/guide/deployment#fallback

Service erstellen

ng generate service <service name>

Links

https://angular.io/tutorial/toh-pt5

Built-In-Server starten

ng serve

Testen

ng test

Probleme

Could not find module "@angular-devkit/build-angular" from

npm install --save-dev @angular-devkit/build-angular

Your global Angular CLI version (6.2.5) is greater than your local version (6.0.8). The local Angular CLI version is used.

npm install --save-dev @angular/cli@latest


Zurück zu JavaScript