Hello Srividya
during weekend i did a few trials and not successful, then i found a more simple tutorial under this link How to Implement Deeplinks in Ionic v5 | by ashok naik | Medium
i have set up everything as required,
at the app.component.ts
initDeeplinks() {
this.deeplinks.route({ '/:slug': 'login' }).subscribe(
match => {
const path = `/${match.$route}/${match.$args['slug']}`;
// Run the navigation in the Angular zone
this.zone.run(() => {
this.router.navigateByUrl(path);
});
},
nomatch => {
console.log("Deeplink that didn't match", nomatch);
});
}
this is the app-routing.module
{
path: 'logins/:slug',
loadChildren: () => import('./logins/logins.module').then( m => m.LoginsPageModule)
},
this is from my logins.page.ts, i purposely generate another page to create a login as it contains a slug and it clashes with the original login page
ngOnInit() {
let slug = this.route.snapshot.paramMap.get('slug');
let url = `https://abc.com/getBlogs?slug=${slug}`;
this.http.get<any[]>(url).pipe(map(res => {
let blog = res[0];
return blog;
})).subscribe(blog => {
this.blog = blog;
});
}
this html.page i cannot understand at⦠why display contents from another page instead of linking up, i just want a simple login page.
<ion-header>
<ion-toolbar color="primary">
<ion-buttons slot="start">
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<div *ngIf="blog">
<img [src]="blog.media_url" [style.width]="'100%'">
<div [innerHTML]="blog.content" padding></div>
</div>
</ion-content>
there is something i cannot figure out from that tutorial is one of the sentence
"Through this setup, we can enter the app with a link like https://myblogs.com/my-first-blog which now becomes /blogs/my-first-blog inside our app."
i cannot find anything related to my-first-blog
i just like to link abc.com/login to my app. why so vast difference with their tutorials?
can you able to see anything different?
based on the tutorial login.page.ts
ngOnInit() {
let slug = this.route.snapshot.paramMap.get('slug');
let url = `https://abc.com/getBlogs?slug=${slug}`;
this.http.get<any[]>(url).pipe(map(res => {
let blog = res[0];
return blog;
})).subscribe(blog => {
this.blog = blog;
});
}
the url link to link the app is it need to write abc.com/getBlogs?slug=login only then the app will be open by the link?
regards