2

I want to run my app instead of http://localhost:4200 at http://localhost:4200/pilot/.

I'm trying to change the base href at index.html but I get Uncaught SyntaxError: Unexpected token <

This is my index.html

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>PrimengQuickstartCli</title>
  <base href="pilot/"/>

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root>Loading...</app-root>
</body>
</html>

And my app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';

import { MessagesModule } from 'primeng/primeng';
import { InputTextModule } from 'primeng/primeng';
import { PasswordModule } from 'primeng/primeng';
import { ButtonModule } from 'primeng/primeng';
import { DataTableModule, SharedModule } from 'primeng/primeng';
import { DialogModule } from 'primeng/primeng';

import { CarService } from './service/carservice';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    ButtonModule,
    MessagesModule,
    InputTextModule,
    PasswordModule,
    ReactiveFormsModule,
    DataTableModule,
    SharedModule,
    DialogModule
  ],
  providers: [CarService],
  bootstrap: [AppComponent]
})
export class AppModule { }

Should I change the folder structure?

I appreciate any help.

2 Answers 2

4

At the end with this was enough in my index.html:

<base href="/pilot/">
Sign up to request clarification or add additional context in comments.

Comments

0

you cam make use of routing module in angular 2 and redirect the user to /pilot when no path is set in the url SO you will have code like this in app.routing.ts {path: '',redirectTo: '/pilot',pathMatch: 'full'},

still need to see if this can be done without routing.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.