答案 0 :(得分:0)
您要在angular上建立一个新项目吗?在laravel上执行dist / index.html文件夹,您是否获得路线/终点到角度?您创建此项目时是否存在dist文件夹?
答案 1 :(得分:0)
检查,在您上方的rootfolder / src / index.html 1)如果您有能力,+ wx是正确的,否则,请为此项目应用正确的权限执行和写入,或者由管理员+ rwx
2)检查rootfolder / src / app / app-routing.module.ts上是否不存在一些错误
正确导入了模块和组件 从“ @ angular / router”导入{Routes,RouterModule};
并正确获得服务 laravel中的角度服务端点示例。
API_URI ='http://localhost:3001/endpoint__api';
export class GnomesService {
gnome: Gnomes = {
name: '',
thumbnail: '',
age:'',
weight: '',
height: '',
hair_color: '',
professions: '',
friends:'',
created_at: new Date()
};
constructor(private http: HttpClient) { }
getGnomes() {
return this.http.get(`${this.API_URI}/gnomes`);
}
getGnome(id: string) {
return this.http.get(`${this.API_URI}/gnomes/${id}`);
}
deleteGnomes(id: string) {
return this.http.delete(`${this.API_URI}/gnomes/${id}`);
}
saveGnome(gnome: Gnomes) {
return this.http.post(`${this.API_URI}/gnomes`, gnome);
}
updateGnome(id: string|number, updatedGnome: Gnomes) {
return this.http.put(`${this.API_URI}/gnomes/${id}`, updatedGnome);
}
}
rootfolder / src / app.routing-module.ts的示例
const routes: Routes = [
{
path: '',
redirectTo: '/gnomes',
pathMatch: 'full'
},
{
path: 'gnomes',
component: GnomesListComponent
},
{
path: 'gnomes/add',
component: GnomesFormComponent
},
{
path: 'gnomes/edit/:id',
component: GnomesFormComponent
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }