2017-02-09 4 views
2

Ich habe angle-cli.json Zeile 9 "outDir": "dist/bice /" und der Build ist in Ordnung, aber ich brauche die Entwicklungsumgebung, die Bice Unterverzeichnis widerspiegeln . Z.B. http://localhost:4200/bice/Wie Angular 2 CLI ng dienen über Unterverzeichnis

Statistiken:

Linux (arch/Antergos)

angular-cli: 1.0.0-beta.24 
node: 7.5.0 
os: linux x64 
@angular/common: 2.4.0 
@angular/compiler: 2.4.0 
@angular/core: 2.4.0 
@angular/forms: 2.4.0 
@angular/http: 2.4.0 
@angular/platform-browser: 2.4.0 
@angular/platform-browser-dynamic: 2.4.0 
@angular/router: 3.4.0 
@angular/compiler-cli: 2.4.0 

Antwort

1

So löste ich dieses Problem, indem sie die Umgebungen zu importieren und wenn die Produktion oder nicht überprüfen.

Als nächstes ist es, wie Sie es höher in der App bringen, so dass ich dies überall einstellen und es über alle Komponenten reflektieren lassen kann. Ich denke auf der Ebene der App-Komponente.

import { Component, OnInit } from '@angular/core'; 
import { environment } from '../../environments/environment'; 

if (environment.production) { 
var urlProduction = null; 
urlProdcution = '/bice'; 
} 

@Component({ 
selector: 'app-presentation', 
templateUrl: './presentation.component.html', 
styleUrls: ['./presentation.component.sass'] 
}) 
export class PresentationComponent implements OnInit { 
moduleTitle1 = 'Presentation Module'; 
moduleDescription1 = 'This will be the short description of the module and what sort of training it provides. From here the user can click the button and the pop-up modal will show up. An idea is to place a check mark on ones that users have completed...'; 
moduleButton1 = 'START MODULE'; 
url = urlProduction; // {{url}} in the template. 

constructor() { } 

ngOnInit() { 

} 
} 
+0

Wenn dies Ihr Problem löst, markieren Sie es als die akzeptierte Antwort. :) – msanford