-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x ] 3.x
I'm submitting a ... (check one with "x")
[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
When setting a tab programmatically via Tabs.select(idx), receive error "Cannot read property 'length' of null" at Tab.NavControllerBase.getActive at Tabs.select
If change tabs by tapping the tab it works fine.
Difficulty: it only happens on first open of the app after clean install. If I close the app and reopen it works fine. Happens on both IOS and Android. Not encountering any other errors prior to it.
Expected behavior:
It should change the tab.
Steps to reproduce:
Related code:
relevant code on child of tabs
@IonicPage({ priority: 'high'})
@Component({
selector: 'page-businesses-page',
templateUrl: 'businesses-page.html',
encapsulation: ViewEncapsulation.None,
providers: [MapPinService]
})
...
export class BusinessesPage {
...
@ViewChild(Content) content: Content;
constructor(
...
private navCtrl: NavController,
private evts:Events
...
)
...
ngOnInit(): void {
...
this.evts.subscribe('tabs:changetab',(data)=>{
var t: Tabs = this.navCtrl.parent;
t.select(data.tabIndex);
});
}
Other information:
Ionic info: (run ionic info
from a terminal/cmd prompt and paste output below):
cli packages: (c:\ProjectCode\app\main\node_modules)
@ionic/cli-plugin-cordova : 1.6.2
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils : 1.7.0
ionic (Ionic CLI) : 3.7.0
global packages:
Cordova CLI : 7.0.0
local packages:
@ionic/app-scripts : 1.3.12
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.1.1
System:
Node : v7.4.0
OS : Windows 10
npm : 4.1.1