Angular Command Line Interface: Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
Zeile 119: Zeile 119:
=== Default Style ändern zu SASS ===
=== Default Style ändern zu SASS ===


Das Kommando
<pre>
ng config defaults.styleExt=scss
</pre>
ausführen und falls die Meldung <code>Value cannot be found.</code> angezeigt wird, dann folgenden Befehl ausführen:
<pre>
ng config schematics.@schematics/angular:component.styleext scss
</pre>
==== Links ====
[https://medium.com/@ngubanethabo.ambrose/migrate-from-css-to-scss-stylesheets-for-existing-angular-application-d61f8061f5b7 https://medium.com/@ngubanethabo.ambrose/migrate-from-css-to-scss-stylesheets-for-existing-angular-application-d61f8061f5b7]
[https://medium.com/@ngubanethabo.ambrose/migrate-from-css-to-scss-stylesheets-for-existing-angular-application-d61f8061f5b7 https://medium.com/@ngubanethabo.ambrose/migrate-from-css-to-scss-stylesheets-for-existing-angular-application-d61f8061f5b7]



Version vom 25. April 2020, 17:45 Uhr

Installation

Neu

sudo npm install -g @angular/cli

Update

npm uninstall -g @angular/cli
npm cache verify
# if npm version is < 5 then use `npm cache clean` 
npm install -g @angular/cli@latest

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

Default Style ändern zu SASS

Das Kommando

ng config defaults.styleExt=scss

ausführen und falls die Meldung Value cannot be found. angezeigt wird, dann folgenden Befehl ausführen:

ng config schematics.@schematics/angular:component.styleext scss

Links

https://medium.com/@ngubanethabo.ambrose/migrate-from-css-to-scss-stylesheets-for-existing-angular-application-d61f8061f5b7

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