Open enchev opened 8 years ago
From @denkomanceski on May 23, 2016 23:29
I think i found another issue regarding navigation/routing. When navigating back from a nested route using android back button it shows the following error
Error: Uncaught (in promise): TypeError: Cannot read property 'urlPath' of null
JS: at resolvePromise (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:496:32)
JS: at resolvePromise (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:481:18)
JS: at /data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:529:18
JS: at ZoneDelegate.invokeTask (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:314:38)
JS: at Object.NgZoneImpl.inner.inner.fork.onInvokeTask (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/@angular/core/src/zone/ng_zone_impl.js:36:41)
JS: at ZoneDelegate.invokeTask (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:313:43)
JS: at Zone.runTask (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:214:48)
JS: at drainMicroTaskQueue (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:432:36)
JS: at ZoneTask.invoke (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:384:22)
JS: at ZoneDelegate.invoke (/data/data/mk.vertex.instantaxipartner/files/app/tns_modules/zone.js/dist/zone-node.js:281:29)
JS: Unhandled Promise rejection: Cannot read property 'urlPath' of null ; Zone: angular ; Task: Promise.then ; Value: TypeError: Cannot read property 'urlPath' of null
JS: Error: Uncaught (in promise): TypeError: Cannot read property 'urlPath' of null
If I navigate to non-nested route (route that does not have another page-router-outlet) it works fine.
Edit: This is when navigating from page-router-outlet to nested page-router-outlet and than going back to the first page-router-outlet. The samples in the nativescript-angular are showing from page-router-outlet to normal router-outlet
Edit2: I modified the nav-component sample from nativescript-angular and the same error is happening so its surely a bug
Edit3: This is also happening if i navigate manually with (tap) and this._router.navigate(['/Start']);
which means its not an issue with the android back button
From @Daxito on May 24, 2016 11:46
+1
This issue was moved to NativeScript/NativeScript#2170
+1
For the TabViews problem I may find a solution by using outlets
from Angular, you can check this out here or here (actually I don't know if you encountered the same problem)
Sample routes:
{
path: 'home', component: HomeComponent,
children: [
{path: '', redirectTo: 'social', pathMatch: 'full'},
{path: 'first', component: FirstComponent, outlet: 'first'},
{path: 'second', component: SecondComponent, outlet: 'second'},
]
},
Sample xml of HomeComponent:
<TabView (selectedIndexChanged)="onHomeSelectedIndexChanged($event)" [selectedIndex]="homeSelectedIndex"
selectedColor="#1083BF">
<StackLayout *tabItem="{title: 'First'}">
<router-outlet name="first"></router-outlet>
</StackLayout>
<StackLayout *tabItem="{title: 'Second'}">
<router-outlet name="second"></router-outlet>
</StackLayout>
</TabView>
Hope it's the solution for your problem
Cheers from France :smile:
+1
Does the fact that this issue was closed in the main nativescript repository mean you only plan on resolving it for the angular side of things?
Are there any news regarding navigation-canceling? I have a hacky workaround for my current project now but a general process using onNavigatingFrom would make a lot of sense.
+1
Update: TabView navigation with separate router outlets is now supported.
From @NathanaelA on May 21, 2016 23:41
Did you verify this is a real problem by searching
Yes, this is a combination post describing several issues with the current routing system. @valentinstoychev requested I do this and I am linking to any existing issues in the issue tracker. :grinning:
Tell us about the problem
Current Navigation system has the following issues:
Which platform(s) does your issue occur on?
Both
Please provide the following version numbers that your issue occurs with:
2.00
Copied from original issue: NativeScript/NativeScript#2162