0

I have created REST API in django. For frontend i am using Angular framework. In django my site for showing all the data is 'http://127.0.0.1:8000/flightschedule/'. Now for angular in routing module i am confused to which path should i give. I have created my code but for that code the API data is not reflecting on client. I am proving routing code below:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FlightListComponent } from "./flight-list/flight-list.component";


const routes: Routes = [
  {path: '', redirectTo: 'flightschedule/', pathMatch: 'full'},
  {path: 'flights', component: FlightListComponent}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
Saurabh G
  • 19
  • 2
  • 8
  • Where is the question in the body? – Mari-Lou A Jan 22 '20 at 08:40
  • I have posted the code in the body. Question is not in the body – Saurabh G Jan 22 '20 at 08:59
  • I suggest that you write a question in the body explaining what you tried, what failed, and why you think this happened. I also think you should format the code using ` , e.g. `imports: [RouterModule.forRoot(routes)` you can find the tool in the editor box. See also someone's edit on a previous question of yours, here: https://stackoverflow.com/posts/57934880/revisions P.S. The downvote is not mine because I do not have enough reputation points that award me this power/ability. – Mari-Lou A Jan 22 '20 at 09:02
  • Maybe the fault lies with my browser, but your link does not work. It reads “This site can’t be reached127.0.0.1 refused to connect.” – Mari-Lou A Jan 22 '20 at 09:13

0 Answers0