从 router-link-page1 跳转 router-link-page2 和 router-link-page3

通过自定义路由

设置router-link-page2的路由后有3个参数,parameter,parameter2,parameter3

{path: 'router-link-page2/:parameter/:parameter2/:parameter3', component: RouterLinkPage2Component}

跳转router-link-page2

<a [routerLink]="['/router-link-page2', parameter,parameter2,parameter3]">前往Page2</a>

获得参数,注意这里是params

import { ActivatedRoute } from '@angular/router';

constructor(
private _activatedroute:ActivatedRoute
) { } ngOnInit() {
this.parameter=this._activatedroute.snapshot.params['parameter'];
this.parameter2=this._activatedroute.snapshot.params['parameter2'];
this.parameter3=this._activatedroute.snapshot.params['parameter3'];
}

通过queryParams

跳转router-link-page3

在queryParams放入一个对象,里面有个属性page3Parameter

<a [routerLink]="['/router-link-page3']" [queryParams]="{page3Parameter:page3Parameter | json }">前往Page3</a>

获得参数,注意这里是queryParams

this.page3Parameter=this._activatedroute.snapshot.queryParams['page3Parameter'];

示例代码

示例代码

参考资料

Angular : Passing Parameters to Route

Angular - Passing object to @Input parameter with routerlink

The Angular 6|7 Router: Handling Route Parameters with Snapshot and Observables (ParamMap)

Angular route传参的更多相关文章

  1. Angular页面传参的四种方法

    1. 基于ui-router的页面跳转传参 (1)在Angular的app.js中用ui-route定义路由,比如有两个页面, 一个页面(producers.html)放置了多个producers,点 ...

  2. angular路由传参和获取路由参数的方法

    1.首先是需要导入的模块 import { Router } from "@angular/router";//路由传参用到 import{ActivatedRoute,Param ...

  3. angular url 传参

    1.路由里配置参数operation 2.页面A跳转时带上参数 $scope.goPage = function (op) { $state.go("app.productConfigadd ...

  4. angular 路由传参

    第一种:<a [routerLink]="['/product']" [queryParams]="{id: 1}">商品详情</a> ...

  5. angularjs向后台传参,后台收不到数据

    angularjs中封装了一个$http服务,用来请求远程资源 参见:HTTP API 其中封装过的$http.post和$http.get使用起来比较方便 后台是php,用$_POST['name' ...

  6. AngularJS实战之路由ui-view传参

    angular路由传参 首页 <!DOCTYPE html> <html ng-app="app"> <head> <title>路 ...

  7. Angular:路由的配置、传参以及跳转

    ①路由的配置 1.首先用脚手架新建一个项目,在路由配置时选择yes 2.用ng g component创建组件 3.在src/app/app-routing.module.ts中配置路由 import ...

  8. angular使用post、get向后台传参的问题

    一.问题的来源 我们都知道向后台传参可以使用get.put,其形式就类似于name=jyy&id=001.但是在ng中我却发现使用$http post进行异步传输的过程中后台是接收不到数据的. ...

  9. angular 实例笔记之嵌套指令间的传参

    最近在项目中遇到了需要嵌套指令的情况,指令在嵌套后子指令必须获得父指令中的数据来进行判断,但是在写传参的时候遇到了坑,因此记录下来,防止以后遗忘,个人的肤浅理解,欢迎大家留言讨论 首先,关于direc ...

随机推荐

  1. Spring常用工具类(ApplicationContextAware、DisposableBean、InitializingBean)

    原创作品,出自 "晓风残月xj" 博客,欢迎转载,转载时请务必注明出处(http://blog.csdn.net/xiaofengcanyuexj). 由于各种原因,可能存在诸多不 ...

  2. [Recompose] Transform Props using Recompose --mapProps

    Learn how to use the 'mapProps' higher-order component to modify an existing component’s API (its pr ...

  3. php 图片加水印文字水印

    /*给图片加文字水印的方法*/ $dst_path = 'http://f4.topitme.com/4/15/11/1166351597fe111154l.jpg';//保证路径正确 $dst = ...

  4. NDK 配置及简单项目

    转载请标明出处:http://blog.csdn.net/xx326664162/article/details/50998720 文章出自:薛瑄的博客 你也能够查看我的其它同类文章,也会让你有一定的 ...

  5. 用DOM4J包实现对xml文件按属性分离。

    转自本人博客:http://www.xgezhang.com/dom4j_xml_separata.html dom4j是一个Java的XML API.类似于jdom.用来读写XML文件的. dom4 ...

  6. Erlang与ActionScript3采用JSON格式进行Socket通讯

    http://hideto.iteye.com/blog/235811 需要下载as3corelib来为ActionScript3处理JSON codec server.erl -module(ser ...

  7. [译]async/await中使用阻塞式代码导致死锁

    原文:[译]async/await中使用阻塞式代码导致死锁 这篇博文主要是讲解在async/await中使用阻塞式代码导致死锁的问题,以及如何避免出现这种死锁.内容主要是从作者Stephen Clea ...

  8. nginx 和 tomcat 生产环境配置 建议和方法

    参考  以下内容: http://blog.csdn.net/lifetragedy/article/details/7708724 一. nginx参数调优 worker_processes 3; ...

  9. CodeBlocks提供了预编译的WxWidgets模块,并预置TDM

    Miscellaneous For Windows, we also provide the pre-compiled wxWidgets, version 2.8.12 used to compil ...

  10. 分位数和分位线(Quantiles and Percentiles)

    分位数有种积分(累积)的含义在. 分位数(即将数据由低至高排列,小于该数的数据占总体的比例达到时最终落到的数): 10%:3000元 20%:5200元 50%:20000元 80%:41500元 9 ...