深层链接不起作用 - 离子 [英] deep links not working - ionic
本文介绍了深层链接不起作用 - 离子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用深度链接和 ionic 3,但我创建的网址不起作用.
im using deeplinks and ionic 3, but the url i created not working.
这是网址:https://lucky.com/prd/rm74fEgBB2frzhagYcov
这是我的代码:
this.deepLinks.route({
'/prd/:id': ProductDetailsPage,
'/rcm/:id': RecommendationDetailsPage
})
.subscribe((match) => {
console.log(match);
}, (nomatch) => {
console.log(nomatch);
});
他没有去订阅功能,也没有去匹配或不匹配
he doesnt go to the subscribe function, either nor to the match or nomatch
我的问题是什么?
推荐答案
请看这里
import {Component, ViewChild} from '@angular/core';
import {Platform, Nav} from 'ionic-angular';
import {StatusBar} from '@ionic-native/status-bar';
import {SplashScreen} from '@ionic-native/splash-screen';
import {Deeplinks} from '@ionic-native/deeplinks';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage: string = 'DashboardPage';
@ViewChild(Nav) nav: Nav;
constructor(public platform: Platform,
statusBar: StatusBar,
splashScreen: SplashScreen,
private deeplinks: Deeplinks) {
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
if (platform.is('cordova')) {
this.deeplinks.routeWithNavController(this.nav, {
'/event/:year/:month/:eventItem/:title': 'ScheduleDetails',
'/email/verify/': 'Login',
'/password/reset/:token': 'ChangePassword',
'/prd/:id': 'ProductDetailsPage',
'/rcm/:id': 'RecommendationDetailsPage'
}).subscribe((match) => {
// console.log('success' + JSON.stringify(match));
}, (noMatch) => {
// alert('error' + JSON.stringify(noMatch));
// console.log('error' + JSON.stringify(noMatch));
});
}
});
}
}
别忘了在 app.module.ts 文件中添加提供者作为深层链接
And don't forgot to add providers as Deeplinks in app.module.ts file
这篇关于深层链接不起作用 - 离子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文