Hi! I’ve set up a ion-split-pane like this:
<ion-split-pane>
<ion-nav [root]="siderot"></ion-nav>
<ion-nav [root]="rot" main></ion-nav>
</ion-split-pane>
To communicate between the siderot and main view rot I’ve created a service like the one described here: https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#parent-to-view-child (rxjs subject observed).
When I send a message through the service to the main view that does either a setRoot or push on the ViewChild it crashes:
this.com.showEntity$.subscribe((entity) => {
this.navCtrl.setRoot(EntityPage, {id: entity.id})
});
Stacktrace:
Error: Uncaught (in promise): TypeError: Cannot read property 'push' of null
TypeError: Cannot read property 'push' of null
at NavControllerBase._queueTrns (http://localhost:8100/build/main.js:51045:20)
at NavControllerBase._setPages (http://localhost:8100/build/main.js:50975:21)
at NavControllerBase.setRoot (http://localhost:8100/build/main.js:50949:21)
at SafeSubscriber._next (http://localhost:8100/build/main.js:91135:27)
at SafeSubscriber.__tryOrUnsub (http://localhost:8100/build/main.js:1355:16)
at SafeSubscriber.next (http://localhost:8100/build/main.js:1304:22)
at Subscriber._next (http://localhost:8100/build/main.js:1257:26)
at Subscriber.next (http://localhost:8100/build/main.js:1221:18)
at Subject.next (http://localhost:8100/build/main.js:6557:25)
at Communication.showEntity (http://localhost:8100/build/main.js:28994:29)
at SafeSubscriber._next (http://localhost:8100/build/main.js:91199:42)
at SafeSubscriber.__tryOrUnsub (http://localhost:8100/build/main.js:1355:16)
at SafeSubscriber.next (http://localhost:8100/build/main.js:1304:22)
at Subscriber._next (http://localhost:8100/build/main.js:1257:26)
at Subscriber.next (http://localhost:8100/build/main.js:1221:18)
at v (http://localhost:8100/build/polyfills.js:3:4864)
at s (http://localhost:8100/build/polyfills.js:3:4289)
at http://localhost:8100/build/polyfills.js:3:4690
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:10284)
at Object.onInvokeTask (http://localhost:8100/build/main.js:44375:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:10220)
at e.runTask (http://localhost:8100/build/polyfills.js:3:7637)
at i (http://localhost:8100/build/polyfills.js:3:3707)
It seems that the queue is null within the NavControllerBase. Does anyone have any idea? Before subscribe is invoked I’ve done a setRoot on the injected NavController, which I assume is the NavController for the main view in the split. That works without problems.