Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何将文本或段落从一页传递到另一页_Angular_Ionic3 - Fatal编程技术网

Angular 如何将文本或段落从一页传递到另一页

Angular 如何将文本或段落从一页传递到另一页,angular,ionic3,Angular,Ionic3,建筑名称和建筑地址应动态进入下一页的红色上角,即区域页面。我希望你们能花点时间回答这个问题。感谢你未来的回答,愿上帝保佑你 home.ts(项目现场) 我们不在下一页,也就是区域页。 area.html <ion-content> <div class="banner"> <p style="font-size: 0.80em; padding-top: 5px; margin-bottom: 0%"> ?????????? </p&

建筑名称和建筑地址应动态进入下一页的红色上角,即区域页面。我希望你们能花点时间回答这个问题。感谢你未来的回答,愿上帝保佑你

home.ts(项目现场)

我们不在下一页,也就是区域页。 area.html

<ion-content>
  <div class="banner">
    <p style="font-size: 0.80em; padding-top: 5px; margin-bottom: 0%">   ??????????   </p>
    <p style="font-size: 0.45em; padding-bottom: 7px; margin-top: 0%">   ??????????  </p>
  </div>
<ion-content style="margin-top: -5%">
  <img src="assets/imgs/layout1.png">
  <page-form></page-form>

</ion-content>
</ion-content>

在home.ts中将数据添加到导航中

AreaPage(){
console.log('AreaPage');
此.navCtrl.push(区域页{
姓名:“姓名123”,
地址:“地址123”
});
}
然后,您可以在您所在区域的
构造函数中输入日期

公共名称:字符串;
公共广播:字符串;
构造函数(专用navParams:navParams){
this.name=navParams.get('name');
this.address=navParams.get('address');
}
现在,您可以在html模板中简单地使用这个变量


{{name}

{{address}


下面是一些关于的进一步阅读。

要显示主页sir中的一些详细信息,您所说的“红色构造函数中的日期”是什么意思?您可以使用
navParams.get('YourParamName')读取变量数据。
您好,先生,我有一个新问题。
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { AreaPage } from '../area/area';


@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController, public navParams: NavParams) {

  }

  AreaPage(){
    console.log('AreaPage');
    this.navCtrl.push(AreaPage);

  }

}
<ion-content>
  <div class="banner">
    <p style="font-size: 0.80em; padding-top: 5px; margin-bottom: 0%">   ??????????   </p>
    <p style="font-size: 0.45em; padding-bottom: 7px; margin-top: 0%">   ??????????  </p>
  </div>
<ion-content style="margin-top: -5%">
  <img src="assets/imgs/layout1.png">
  <page-form></page-form>

</ion-content>
</ion-content>
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';


@IonicPage()
@Component({
  selector: 'page-area',
  templateUrl: 'area.html',
})
export class AreaPage {


  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad AreaPage');
  }

}