angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

Cordova WebView - router.navigate doesn't work completely (offline) #432

Closed maerlynflagg closed 6 years ago

maerlynflagg commented 6 years ago

using

my routing config

const ROUTES: Routes = [
    { path: '', component: MenuComponent },
    { path: 'menu', component: MenuComponent },
    {
        path: 'realisation', component: RealisationComponent, children: [
            { path: '', redirectTo: '/realisation/process', pathMatch: 'full' },
            { path: 'process', component: ProcessComponent }
        ]
    },
    {
        path: 'sheet', component: AdviceReportComponent, children: [
            { path: 'report', component: ReportComponent },
            { path: 'foto', component: FotoComponent },
        ]
    },
];

What the web application do

in the ProcessComponent is a click event (angular binded). in this click event is this call, which navigate to the AdviceReportComponent:

_self._router.navigate(['/sheet'], { skipLocationChange: true });

device is online

all works fine. all navigate calls.

device is offline

the other navigate calls are okay. they working same like app in online mode. for example:

        _self._router.navigate(['process'], { relativeTo: this._route }); 
        this._router.navigateByUrl("realisation/process");

But one navigate usage doesn't work like the online mode:

_self._router.navigate(['/sheet'], { skipLocationChange: true });

after this call, there ~ 20 seconds or more to the call of constructor of the child component. i removed the option "skipLocationChange", but it doesn't helps.

Notice

if i using Angular v~ 4.0.0. all navigate calls in the application works offline. but there is another issue in offline mode: after code execution of the constructors of the child components like ReportComponent the life cycle events (ngOnInit...) doesn't call directly. there is a delay of ~ 20 seconds (not only in a Cordova Android WebView). the upgrade of Angular to ~ 4.2.0 fixed the call issue of life cycle events, but broken the router.navigate() usage in offline mode.