如何将一页的.ts文件中的数据绑定到另一页的html

问题描述 投票:0回答:1

我正在尝试在Angular中实现绑定概念。我在PageOne.ts中有以下代码

this.navCtrl.push("PageTwo",{
      paramType: params,

    })

PageTwo.html:

<span>{{paramType}}</span>

我试图访问另一个页面模板中的paramType。但数据未成功通过。

angular data-binding
1个回答
0
投票

在组件之间传递数据的最佳方法是服务。在这里阅读更多:https://angular.io/tutorial/toh-pt4

但为了能够帮助您,我们需要有关您的项目和代码的更多信息!

© www.soinside.com 2019 - 2024. All rights reserved.