【发布时间】:2018-05-03 12:57:10
【问题描述】:
设法为 Ionic 安装和设置本机深度链接模块。
应用程序即使在完全关闭的冷状态下也能正常加载。
但是,我的路线没有将我带到正确的页面。它只显示应用程序的最后一页,或者如果它从冷状态启动应用程序,则显示主页。
app.component.ts
...
import { Deeplinks } from '@ionic-native/deeplinks';
import { Detail1Page } from '../pages/layout/app1/detail1/detail1';
...
constructor(private deeplinks: Deeplinks.........
...
this.platform.ready().then(() => {
this.splashScreen.hide();
this.deeplinks.route({
'/item/:itemId': Detail1Page
}).subscribe((match) => {
console.log('Successfully matched route', JSON.stringify(match));
}, (nomatch) => {
console.error('Got a deeplink that didn\'t match', JSON.stringify(nomatch));
});
}
...
控制台日志显示:
Successfully matched route {"$args":{"itemId":"9"},"$link":{"path":"/item/9","queryString":"","fragment":"","host":"my.app.com","url":"https://my.app.com/item/9","scheme":"https"}}
app.module.ts
...
import { Deeplinks } from '@ionic-native/deeplinks';
...
providers: [
Deeplinks,
...
detail1.ts
...
this.itemId = this.navParams.get('itemId');
...
非常感谢您的帮助 - 整天都在努力解决这个问题 :)
【问题讨论】:
标签: angular ionic-framework ionic3 deep-linking