本文介绍了深层链接不起作用-离子性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了深层链接和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);
});
他既不使用订阅功能,也不使用match或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文件中将提供程序添加为Deeplinks
And don't forgot to add providers as Deeplinks in app.module.ts file
这篇关于深层链接不起作用-离子性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!