angular - 离子深度链接错误,离子 3 / Angular 5 应用程序
问题描述
离子深度链接错误,
错误:未捕获(承诺中):TypeError:Object(...) 不是函数 TypeError:Object(...) 不是 Deeplinks.route 中的函数(http://localhost:8100/build/vendor.js :94242:126 )
代码:
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private deeplinks: Deeplinks) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.deeplinks.route({
'/': {},
'/reset-password/:Id': MmresetpasswordPage
})
.subscribe(match => {
alert(JSON.stringify(match));
}, nomatch => {
alert(JSON.stringify(nomatch));
});
});
解决方案
安装深度链接的 v5:npm i -s @ionic-native/deeplinks@5
import in component
s 和module
s 之类的:(import {Deeplinks} from '@ionic-native/deeplinks/ngx'
注/ngx
在最后)
然后component.ts
像这样声明:constructor(private deeplinks:Deeplinks){}
然后app.module.ts
像这样提供:providers:[Deeplinks]
推荐阅读
- oop - 相当于 c# myVariable.GetType().Name 的进度?
- android - 如何将一个节点的数据复制为 Firebase 中另一个节点的子数据?
- javascript - 当产品在 laravel 中为空时禁用 addtocart 按钮
- reporting-services - SSRS - 删除日期范围参数中的重复日期
- html - 播放器从 mp4 开始跳过 8 个字节
- javascript - 通过 Javascript 更新图像 SRC 需要更快
- swift - 如何在 SwiftUI 中 ViewLoads 时显示视图
- python - Python Curses 模块预设文本
- arrays - 有没有更好的方法将行与另一列中的名称组合在一起
- dictionary - 为 Kotlin 中的每个 Enum 类型构造一个 Map