美文网首页
参数快照

参数快照

作者: c59ffede9db6 | 来源:发表于2017-05-14 15:31 被阅读0次

如果不路由就没事

<input type="button" name="" value="商品详情" (click)='toProductDetails()'>
import { Component } from '@angular/core';
import {Router} from '@angular/router';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app works!';
constructor(private router:Router){

}
toProductDetails(){
this.router.navigate(['/product',2])
}
}


import { Component, OnInit } from '@angular/core';
import {ActivatedRoute,Params} from '@angular/router';
@Component({
  selector: 'app-product',
  templateUrl: './product.component.html',
  styleUrls: ['./product.component.css']
})
export class ProductComponent implements OnInit {
  private productId:number;
  constructor(private routeInfo:ActivatedRoute) { }

  ngOnInit() {
    this.routeInfo.params.subscribe((params:Params)=>this.productId=params['id']);
    // this.productId=this.routeInfo.snapshot.params['id']
  }

}

相关文章

  • 参数快照

    如果不路由就没事 import { Component } from '@angular/core';import...

  • 参数快照,参数订阅——2.在路由时传递数据

    注意:获取路由参数的时候,一定要注意,一个组件不会路由到自身,可以使用参数快照。反之,参数订阅。

  • Vector-cdd配置

    cdd配置软件:CANdelaStudio 8.5 双击打开文件: 1、 DTC: 2、配置快照和扩展数据参数: ...

  • 13、Zookeeper问题汇总

    1、Zookeeper集群如何增加或减少机器 2、Zookeeper清理快照文件 开启参数自动清理autopurg...

  • JVM 堆日志查看,参数,快照

    1. 初始运行时VM 说明: 此处尝试给1M 但是最小totalMemory(-Xms) = 1.9375MBma...

  • 2019-03-22

    iOS 屏幕快照(view 截图/快照) layer 快照 view 快照

  • dubbo简单使用

    Zookeeper 序号参数名说明7snapCount设置多少次事务日志输出后,触发一次快照(snapshot),...

  • jvm-堆快照(获取hprof文件)

    1.输出方式 有两种方式: a.启动参数配置outofmemory时触发打印堆快照 exportJAVA_OP...

  • kvm快照功能

    1.创建快照 2.查看快照列表 3.恢复快照 4.查看当前快照 5.快照存储目录 6.删除快照

  • KVM管理快照

    查询正在运行的镜像 创建快照 查看快照 恢复到最新的快照 恢复到某个快照 删除快照

网友评论

      本文标题:参数快照

      本文链接:https://www.haomeiwen.com/subject/npyqxxtx.html