我希望能够在我的Angular 2应用程序外导航到mywebsite.com/api。 这应该带我到同一个服务器上托管的API应用程序。如何使用Angular 2访问API?
这是我目前的路线设置。
export const routes: Routes = [
{path: '', redirectTo: '/home', pathMatch: 'full'},
{path: 'home', component: HomeComponent},
{path: 'registration', component: RegistrationComponent},
{path: '**', redirectTo: '/home', pathMatch: 'full'}
];
如何排除路径,因为我不需要组件或模板?
PHP ANE xample你是说你想打一个API终点?您需要使用angular2的http包来执行此操作。什么是你使用的后端? – wuno
我正在主持一个接收和回复json的php应用程序。 – mcfresh
所以你试图做的是击中api结束点然后处理响应权? – wuno