ereza
April 27, 2017, 7:35am
1
Hi, I try to use ionic3 lazyloading feature.
But I’m getting following error: Uncaugth (in promise): invalid link: TabsPage.
My Tabspage has a module class “tabs.module.ts” which looks fine.
import {NgModule} from “@angular /core”;
import {TabsPage} from “./tabs”;
import {IonicPageModule} from “ionic-angular”;
@NgModule ({
declarations: [TabsPage,],
imports: [IonicPageModule.forChild(TabsPage),],
exports: [TabsPage,]
})
export class TabsPageModule {
}
and in app.components.ts the link looks like
rootPage : string = “TabsPage”;
May somebody can help me?
1 Like
In TabsPage.ts :
add this:
@IonicPage(
{
name: 'tabs-page'
}
)
In app.components.ts
rootPage: string = 'tabs-page';
Please try it!
11 Likes
ereza
April 27, 2017, 8:25am
4
Ah, sorry! It worked, I added @IonicPage to a wrong place.
thx very much!
nylex
April 27, 2017, 1:13pm
5
Do u then lazy load all tab inner pages too or not?
ereza
April 27, 2017, 1:29pm
6
Right now not, but I will change it asap.
Why? Do you experience problems doing so?
nylex
April 27, 2017, 2:25pm
7
i gave it a quick try, didnt work, maybe needed caffeine to kick in. will try again today.
ereza
April 27, 2017, 7:16pm
8
I will give it a try this weekend, if I succeed I will let you know.
I don’t see the benefit in changing the name
of @IonicPage
.
nylex
April 28, 2017, 6:08am
10
It works fine, i just tested it. Put tab page names on quotes.
ereza
May 4, 2017, 5:20am
11
Yes, I tried it myself, it works just fine.
rashnk
May 9, 2017, 11:11am
12
im too going to try this, but where did u get this solution from, docs ?
ereza
May 9, 2017, 11:24am
13
From here: https://www.youtube.com/watch?v=7j-P-ElAqe8
And I had to use following annotation for each page, thx to johnny5015
@IonicPage (
{
name: ‘tabs-page’
}
)
rashnk
May 9, 2017, 11:29am
14
but this didnt solve my problem, every time this error occurs, i have to rerun ionic serve to get rid of this
ereza
May 9, 2017, 11:49am
15
Please post your Ionic version specs.
This my error when apply your solution
Runtime Error
Uncaught (in promise): invalid link: tabs-page
Stack
Error: Uncaught (in promise): invalid link: tabs-page
at c (http://localhost:8100/build/polyfills.js:3:13535 )
at Object.reject (http://localhost:8100/build/polyfills.js:3:12891 )
at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:43003:16 )
at NavControllerBase._failed (http://localhost:8100/build/vendor.js:42991:14 )
at http://localhost:8100/build/vendor.js:43046:59
at t.invoke (http://localhost:8100/build/polyfills.js:3:9283 )
at Object.onInvoke (http://localhost:8100/build/vendor.js:4508:37 )
at t.invoke (http://localhost:8100/build/polyfills.js:3:9223 )
at r.run (http://localhost:8100/build/polyfills.js:3:4452 )
at http://localhost:8100/build/polyfills.js:3:14076
Ionic Framework: 3.5.3
Ionic App Scripts: 2.0.2
Angular Core: 4.1.3
Angular Compiler CLI: 4.1.3
Node: 6.10.3
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
mebibou
September 21, 2017, 1:08pm
17
I spent a lot of times on this to realise the file names are very important !! If you have a page with name app.ts
, you need a module named app.module.ts
or it won’t work! so nasty
1 Like
snort
September 29, 2017, 5:46pm
19
This is not an uncommon thing amongst frameworks. It’s a “convention over configuration” approach. Problem is that some frameworks (looking at you, Angular) mix the two, so you never know what to expect in a given scenario.
Someone can explain me why this is necesary? why we have to specify a name and the default ‘TabsName’ is not working?