RouterOutlet

一个占位符,Angular 会根据当前的路由器状态动态填充它。

Acts as a placeholder that Angular dynamically fills based on the current router state.

查看"说明"...

NgModule

选择器

属性

属性说明
@Output('activate')
activateEvents: EventEmitter<any>
@Output('deactivate')
deactivateEvents: EventEmitter<any>
isActivated: boolean 只读
component: Object 只读
activatedRoute: ActivatedRoute 只读
activatedRouteData: Data 只读

模板变量参考手册

标识符用途
outlet#myTemplateVar="outlet"

说明

      
      <router-outlet></router-outlet>
<router-outlet name='left'></router-outlet>
<router-outlet name='right'></router-outlet>
    

每当新组件实例化之后,路由出口就会发出一个激活事件;在销毁时则发出取消激活的事件。

A router outlet will emit an activate event any time a new component is being instantiated, and a deactivate event when it is being destroyed.

<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
      
      <router-outlet
  (activate)='onActivate($event)'
  (deactivate)='onDeactivate($event)'></router-outlet>
    

方法

ngOnDestroy(): void
      
      ngOnDestroy(): void
    
参数

没有参数。

返回值

void

ngOnInit(): void
      
      ngOnInit(): void
    
参数

没有参数。

返回值

void

RouteReuseStrategy 的指示,从子树中分离开时调用

Called when the RouteReuseStrategy instructs to detach the subtree

detach(): ComponentRef<any>
      
      detach(): ComponentRef<any>
    
参数

没有参数。

返回值

ComponentRef<any>

RouteReuseStrategy 的指示,把以前分离的子树重新附加回来时调用

Called when the RouteReuseStrategy instructs to re-attach a previously detached subtree

deactivate(): void
      
      deactivate(): void
    
参数

没有参数。

返回值

void