import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule, Routes} from '@angular/router';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { ListUserComponent } from './components/list-user/list-user.component';
import { UserFormComponent } from './components/user-form/user-form.component';
import { UserService } from './shared_service/user.service';
import { ListBioLogUserComponent } from './components/list-bio-log-user/list-bio-log-user.component';
const appRoutes:Routes=[
{path:'', component:ListUserComponent},
{path:'op', component:UserFormComponent},
{path:'biologusers', component:ListBioLogUserComponent}
];
@NgModule({
declarations: [
AppComponent,
ListUserComponent,
UserFormComponent,
ListBioLogUserComponent
],
imports: [
BrowserModule,
HttpModule,
RouterModule.forRoot(appRoutes)
],
providers: [UserService],
bootstrap: [AppComponent]
})
export class AppModule { }
路径op
,biologusers
无效。但 Angular CLI 正常运行。
我只是运行ng build --prod
并从dist
文件夹中获取所有文件并将其放入Spring启动项目resources/static
文件夹中。
答案 0 :(得分:0)
将条目放在controller
示例:
@Component
@Controller
public class Ctrl {
@RequestMapping("/ex1")
String Ex1(ModelMap modal) {
return "index";
}
@RequestMapping("/ex2")
String Ex2(ModelMap modal) {
return "index";
}
}