about.html(跳转页面)

<ion-content padding>
<ion-list>
<ion-item *ngFor="let he of contacts" (click)="onClick(event,he)">
<ion-avatar item-left>
<img src="../assets/imgs/{{he.img}}.jpg" alt=""/>
</ion-avatar>
<h3 class="mymargin">{{he.name}}</h3>
<p>{{he.text}}</p>
</ion-item> </ion-list>
</ion-content>

about.ts(跳转页面)

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular'; @Component({
selector: 'page-about',
templateUrl: 'about.html'
})
export class AboutPage { constructor(public navCtrl: NavController) { }
public contacts=[
{"img":"bg2","name":"麦兜","text":"好嗨哦"},
{"img":"bg3","name":"小胖","text":"好嗨哦"},
{"img":"bg5","name":"小猪佩奇","text":"好嗨哦"}
];
onClick(event,he){
this.navCtrl.push('DetailPage',{test : he});
} }

跳转到的页面(使用ionic g page detail 指令生成跳转到的新页面)

修改 app.module.ts 文件 很重要:如下

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component'; import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { RegisterPage } from '../pages/register/register';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
/*添加这行*/
import { DetailPageModule } from '../pages/detail/detail.module'; import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen'; @NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
RegisterPage,
HomePage,
TabsPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
DetailPageModule//添加这个
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
RegisterPage,
HomePage,
TabsPage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}

detail.ts接收变量

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular'; @IonicPage()
@Component({
selector: 'page-detail',
templateUrl: 'detail.html'
})
export class DetailPage {
data:any;
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.data = navParams.get('test');
} }

detail.html显示

<ion-header>
<ion-navbar>
<ion-title>detail</ion-title>
</ion-navbar>
</ion-header> <ion-content padding>
{{data.name}}
</ion-content>

好了整个流程就是这样的!鼓掌!!!

ionic3 导航的应用(页面跳转与参数传递)的更多相关文章

  1. Jsp与servlet之间页面跳转及参数传递实例(转)

    原网址:http://blog.csdn.net/ssy_shandong/article/details/9328985 11. jsp与servlet之间页面跳转及参数传递实例 分类: Java ...

  2. jquerymobile页面跳转和参数传递

    http://blog.csdn.net/chen052210123/article/details/7481578 页面跳转: 页面跳转时pagebeforechange事件会被触发两次,通过$(d ...

  3. Android+Jquery Mobile学习系列(4)-页面跳转及参数传递

    关于页面转场,这个必须得专门列出来说明一下,因为Jquery Mobile与普通的Web发开有一些区别,这个对于新手如果不了解的话,就会钻到死胡同.撸主前段时间就是很急躁地上手开发程序,结果在页面转场 ...

  4. Vue简单项目(页面跳转,参数传递)

    一.页面跳转 1.和上篇文章一样的建文件的步骤 2.建立成功之后,在src文件夹下面添加新的文件夹pages 3.在pages里面添加新的文件Home.Vue和Detail.Vue 4.设Home.V ...

  5. 微信小程序-页面跳转与参数传递

    QQ讨论群:785071190 微信小程序页面跳转方式有很多种,可以像HTML中a标签一样添加标签进行跳转,也可以通过js中方法进行跳转. navigator标签跳转 <view class=& ...

  6. 微信小程序 导航 4种页面跳转 详解

    1.wx.navigateTo   保留当前页面,跳转到应用内的某个页面,目前页面路径最多只能十层.  参数:url(可携带参数) .success .fail .complete 可用wxml代替: ...

  7. jquery导航栏html页面跳转导航字体变色

    html代码: <div class="collapse"> <ul class="nav"> <li><a href ...

  8. 微信小程序插件内页面跳转和参数传递(转)

    在此以插件开发中文章列表跳传文章详情为例. 1.首先在插件中的文章列表页面wxml中绑定跳转事件. bindtap='url' data-id="{{item.article_id}}&qu ...

  9. 微信小程序插件内页面跳转和参数传递

    在此以插件开发中文章列表跳传文章详情为例. 1.首先在插件中的文章列表页面wxml中绑定跳转事件. bindtap='url' data-id="{{item.article_id}}&qu ...

随机推荐

  1. [Swift]LeetCode343. 整数拆分 | Integer Break

    Given a positive integer n, break it into the sum of at least two positive integers and maximize the ...

  2. Kubernetes---pod--重启策略

    restartPolicy: Always: 默认 , 总是重启 OnFailure : 错误事重启 Never: 从来不重启 Default  to Always:

  3. PyCharm无法激活

    如果你激活软件遇到问题 (Pycharm.GoLand.idea.phpstorm.webstorm.sublime.ultraEdit.win10等等) 比如: 激活框提示Key is invali ...

  4. 10.Flask上下文

    1.1.local线程隔离对象 不用local对象的情况 from threading import Thread request = ' class MyThread(Thread): def ru ...

  5. expect--自动批量分发公钥脚本

    1.在使用之前,先安装epel源,yum install expect -y2.写分发脚本,后缀为exp #!/usr/bin/expect set host_ip [lindex $argv 0] ...

  6. Vim 复制粘帖格式错乱问题的解决办法

    有时候,复制文本(尤其是代码)到 Vim,会出现格式错乱的问题.看样子,应该是自动缩进惹得祸.本文不去深究原因,直接给出解决方法. 1. paste 模式 运行如下命令,进入 paste 模式: :s ...

  7. PyQt:左侧选项卡

    写在前面 正在用pyqt写我们比赛项目的客户端,针对左侧选项卡,写了一个简单的demo.记录一下. 环境 Python3.5.2 PyQt5 陈述 用的结构是左边一个QListWidget + 右边Q ...

  8. 如何优雅的使用 Angular 表单验证

    随便说说,这一节可以跳过 去年参加 ngChine 2018 杭州开发者大会的时候记得有人问我: Worktile 是什么时候开始使用 Angular 的,我说是今年(2018年) 3 月份开始在新模 ...

  9. Linux基础知识第七讲,用户权限以及用户操作命令

    目录 Linux基础知识第七讲,用户权限以及用户操作命令 一丶简介linux用户,用户权限,组的概念. 1.1 基本概念 1.2 组 1.3 ls命令查看权限. 二丶用户权限修改命令 1.chmod ...

  10. docker 常用命令和使用

    首先安装Docker CE 在ubantu上,参照https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-reposito ...