一:
const crisisCenterRoutes: Routes = [
{
path: '1',
component: CrisisCenterComponent,
children: [
{
path: '2',
component: CrisisListComponent,
children: [
{
path: ':id',
component: CrisisDetailComponent,
canDeactivate: [CanDeactivateGuard],
resolve: {
crisis: CrisisDetailResolver
}
},
{
path:'asdf',
component:DuanOneComponent
},
{
path: 'homi',
component: CrisisCenterHomeComponent
},
{
path:'',
component:DuanTwoComponent
}
]
}
]
}
];
这个路由访问http://localhost:4200/crisis-center/1/2/asdf是访问不到的
需要将:id的路由往后放才可以
children: [
{
path:'asdf',
component:DuanOneComponent
},
{
path: 'homi',
component: CrisisCenterHomeComponent
},
{
path: ':id',
component: CrisisDetailComponent,
canDeactivate: [CanDeactivateGuard],
resolve: {
crisis: CrisisDetailResolver
}
},
{
path:'',
component:DuanTwoComponent
}
]
二:
安装node-sass注意事项
新项目
ng new My_New_Project --style=scss
已有项目
安装node-sass由于需要连接github在连接aws,很难成功,需要在.npmrc文件>中(项目中自己建立)再加入如下内容,让这些连接也都只连接淘宝镜像:
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
运行
npm install node-sass --save-dev
更改
"defaults": {
"styleExt": "scss",
}
"styles": [
"styles.scss"
],