一、路由配置
BrowserAnimationsModule是必须要引用的
路由data属性也是必须要加的,名字可自拟
import {
NgModule } from '@angular/core';
import {
BrowserModule } from '@angular/platform-browser';
import {
BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
RouterModule } from '@angular/router';
import {
AppComponent } from './app.component';
import {
HomeComponent } from './home.component';
import {
AboutComponent } from './about.component';
import {
InsertRemoveComponent } from './insert-remove.component';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot([
{
path: '', pathMatch: 'full', redirectTo: '/enter-leave' },
{
path: 'heroes', component: HeroListPageComponent, data