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. 动态规划----最长递增子序列问题(LIS)

    题目: 输出最长递增子序列的长度,如输入 4 2 3 1 5 6,输出 4 (因为 2 3 5 6组成了最长递增子序列). 暴力破解法:这种方法很简单,两层for循环搞定,时间复杂度是O(N2). 动 ...

  2. SUSE12Sp3安装配置.net core 生产环境-总汇(持续更新中...)

    最近正在使用SUSE系统,项目环境是没有外网的,所以提供的基本都是离线安装,对应的安装包可能需要自行去下载,我这边就不整理了. 网上查找SUSE的资料比较少,于是整理了一下,希望对有需要的人有一点点帮 ...

  3. 在vue中使用svg sprite

    概述 这几天研究了一下在vue中使用svg sprite,有些心得,记录下来,供以后开发时参考,相信对其它人也有用. 在vue中导入svg 在vue中导入svg的方法有很多种,比如在img标签的src ...

  4. [Swift]LeetCode506. 相对名次 | Relative Ranks

    Given scores of N athletes, find their relative ranks and the people with the top three highest scor ...

  5. [Swift]LeetCode526. 优美的排列 | Beautiful Arrangement

    Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is const ...

  6. [Swift]LeetCode867. 转置矩阵 | Transpose Matrix

    Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it ...

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

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

  8. Centos7中文乱码问题的解决

    刚安装centos7之后,语言默认不是中文,导致中文路径或中文文件在系统中显示为乱码,查了些资料解决了这个问题. 1 查看和安装中文库 [root@bogon ~]# echo $LANG zh_CN ...

  9. 12.Flask-Restful

    定义Restful的视图 安装:pip install flask-restful 如果使用Flask-restful,那么定义视图函数的时候,就要继承flask_restful.Resourse类, ...

  10. MVC实现多级联动

    前言 多级联动(省级联动)的效果,网上现成的都有很多,各种JS实现,Jquery实现等等,今天我们要讲的是在MVC里面,如何更方便.更轻量的实现省级联动呢? 实现效果如下: 具体实现 如图所示,在HT ...