我在 django 中创建了 REST API。对于前端,我使用的是 Angular 框架。在 django 中,我显示所有数据的网站是“ http://127.0.0.1:8000/flightschedule/ ”。现在对于路由模块中的角度,我很困惑我应该给出哪条路径。我已经创建了我的代码,但是对于该代码,API 数据没有反映在客户端上。我在下面证明路由代码:
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 { }