Define a auxilliary router:

export const ROUTES: Routes = [
{
path: 'folder/:name',
component: MailFolderComponent,
resolve: {
messages: MailFolderResolver
}
},
{
path: 'message/:id',
component: MailViewComponent,
outlet: 'pane',
resolve: {
message: MailViewResvoler
}
}
];

HTML:

@Component({
selector: 'mail-app',
styleUrls: ['mail-app.component.scss'],
template: `
<div class="mail">
<router-outlet
(activate)="onActivate($event)"
(deactivate)="onDeactivate($event)"
></router-outlet>
</div>
<div class="mail">
<router-outlet
name="pane"
></router-outlet>
</div>
`
})

Routing by routerLink:

    <a
class="mail-item"
[routerLink]="['', {outlets: {pane: ['message', message.id]}}]"
routerLinkActive="active">

Clean auxiliary router:

          <a
[routerLink]="[ { outlets: { primary: 'folder/inbox', pane: null } } ]"
routerLinkActive="active">
Inbox
</a>
<a
[routerLink]="[ { outlets: { primary: 'folder/trash', pane: null } } ]"
routerLinkActive="active">
Trash
</a>

Routing by JS:

  openMessage(e) {
e.preventDefault();
this.router.navigate(['', {outlets: {pane: ['message', this.message.id]}}])
}

RouterLink's advantage:

Angular will convert routerLink to an 'a' tag, so all the broswer feature for 'a' tag you can get from RouterLink.

[Angular] Auxiliary named router outlets的更多相关文章

  1. Angular.js之Router学习笔记

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  2. http://angular.github.io/router/

    Angular New Router Guide Configuring the Router- This guide shows the many ways to map URLs to compo ...

  3. angular 的ui.router 定义不同的state 对应相同的url

    Angular UI Router: Different states with same URL? The landing page of my app has two states: home-p ...

  4. [Angular 2] Child Router

    Benefit to use child router is Angualr 2 then can lazy load the component on demand. Define a child ...

  5. [Angular] Subscribing to router events

    In our root component, one thing we can do is subscribe to Router events, and do something related t ...

  6. [Angular2 Router] Auxiliary Routes bit by bit

    Article Github Auxiliary Routes is is little bit hard to understand. Here is demo, link You can see ...

  7. [Angular2 Router] Build Angular 2 Navigation with routerLink

    Angular 2 navigation is configured using the routerLink directive. The routerLink directive behaves ...

  8. User Authentication with Angular and ASP.NET Core

    User authentication is a fundamental part of any meaningful application. Unfortunately, implementing ...

  9. angular 之路由

    1.用angular-cli建一个工程自带路由怎么做? 命令:ng new  项目名 --routing 2.怎么使用路由器和路由器的一些基本使用. //html页面 <a routerLink ...

随机推荐

  1. 企业网管软件之SOLARWINDS实战-制作拓扑图

    企业网管软件之SOLARWINDS实战-制作拓扑图-开始 企业网管软件之SOLARWINDS实战-制作拓扑图 本文出自 "李晨光原创技术博客" 博客,谢绝转载!

  2. MySQL主从同步配置(详细图解)

    说明:该篇博客是博主一字一码编写的,实属不易,请尊重原创,谢谢大家! 目录 一丶叙述 二丶备份主服务器原有数据到从服务器 三丶配置主服务器master(192.168.4.63) 四丶配置从服务器sl ...

  3. OrmLite使用小结(一)

    在使用OrmLite过程中,遇到了不少问题.鉴于中文文档比較少,看英文文档又不知道怎样看起.仅仅能遇到问题查找解决方法并整理出来,如有错误,希望能指正! ** 1.模糊条件查询 ** 使用条件查询时. ...

  4. phoenixframe自己主动化平台在Linux环境下运行用例的说明

    phoenixframe自己主动化平台支持在Linux环境下使用phantomjs,Firefox.chrome运行測试用例.但有下面几个问题须要注意: 1.若无法启动phantomjs,Firefo ...

  5. 开源课程管理系统(CMS):Moodle

    开源课程管理系统(CMS):Moodle 一.总结 1.php开发的cms,可借鉴参考用 二.Moodle(百度) Moodle(Modular Object-Oriented Dynamic Lea ...

  6. C语言库函数,头文件

    参看:https://zhidao.baidu.com/question/328173842.html 该文件包含了的C语言标准库函数的定义 stdlib.h里面定义了五种类型.一些宏和通用工具函数. ...

  7. ThinkPHP5.0的安装

    ThinkPHP5.0的安装很简单: 1.下载“phpstudy”安装 2.下载thinkphp源文件 3.把thinkphp源文件解压并放到phpstudy目录下的“WWW”目录 4.然后开启服务并 ...

  8. GO语言学习(十六)Go 语言结构体

    Go 语言结构体 Go 语言中数组可以存储同一类型的数据,但在结构体中我们可以为不同项定义不同的数据类型. 结构体是由一系列具有相同类型或不同类型的数据构成的数据集合. 结构体表示一项记录,比如保存图 ...

  9. HTTP网络协议(二)

    HTTP报文内的HTTP信息 HTTP协议交互的信息被称为HTTP报文,请求端的HTTP报文叫做请求报文,响应端的叫做响应报文.    HTTP为了提升传输速率,其在传输数据时,按照数据原样进行压缩传 ...

  10. AspJpeg2.0组件教程完整版 aspjpeg教程...

    AspJpeg是一款功能强大的基于Microsoft IIS环境的图片处理组件,网络上对其进行详细和深入介绍的中文文章并不多,即使有一般也只是牵涉到图片缩略图和图片水印,这与其为英文版本有着密切的关系 ...