Just starting out with Angular and encountering an issue. Whenever I access the app using localhost:9500/pp URL, it keeps redirecting to the home page.
Here's my app.module.ts
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {RouterModule} from '@angular/router';
import {AppComponent} from './app.component';
import {NavComponent} from './nav/nav.component';
import {GrowlModule, MenubarModule} from 'primeng/primeng';
import {FlightModule} from './flight/flight.module';
@NgModule({
declarations: [
AppComponent,
NavComponent
],
imports: [
RouterModule.forRoot([
{ path: '', redirectTo: '', pathMatch: 'full'}
]),
BrowserModule,
BrowserAnimationsModule,
RouterModule,
FlightModule,
MenubarModule,
GrowlModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
}
This is my flight.module.ts
import {NgModule} from '@angular/core';
import {ViewFlightComponent} from './view-flight.component';
import {CommonModule} from '@angular/common';
import {HttpModule} from '@angular/http';
import {DataTableModule} from 'primeng/primeng';
import {RouterModule} from '@angular/router';
@NgModule ({
declarations: [
ViewFlightComponent
],
imports: [
CommonModule,
HttpModule,
DataTableModule,
RouterModule.forChild([
{path: 'pp', component: ViewFlightComponent}
])
],
providers: []
})
export class FlightModule {
}
This is my ViewFlightComponent
import {Component} from '@angular/core';
@Component({
templateUrl: './view-flight.component.html',
styleUrls: ['./view-flight.component.css']
})
export class ViewFlightComponent {
}
This is my view-flight.comoponent.html
<div>
Hello ..
</div>
Every time I use localhost:9500/pp
URL, it keeps taking me back to the home page. I've tried troubleshooting but can't figure out what's causing this issue. Any help would be greatly appreciated.