我希望能夠在我的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