Select Tab

When i route to a new page with tabs, i am selecting 2nd tab when loading 
But it is always selecting 1st tab and i see script error

From another page
 redirectToBacklog(rowany) {
    console.log('redirect IN'row);
    var getRouteLink = "/project-charts/backlog"
    this.router.navigateByUrl(getRouteLink, { state: { rowDet: row } });
    
  }

if (history.state.rowDet) {
          if (this.tabInstance) {
            this.itemId = history.state.rowDet.itemId;
            this.selItemRow = this.aBacklogs.filter(e => e.itemId == this.itemId)[0];
            this.tabInstance.selectedItem = 1;           
          }

          console.log(' this.state$'this.selItemRow);
        }

ERROR TypeError: Cannot read property 'children' of null
    at TabComponent.getTrgContent (ej2-navigations.es2015.js:7697)
    at TabComponent.setActive (ej2-navigations.es2015.js:7954)
    at TabComponent.selectingContent (ej2-navigations.es2015.js:8576)
    at TabComponent. (ej2-navigations.es2015.js:8548)
    at TabComponent.push../node_modules/@syncfusion/ej2-angular-base/src/component-base.js.ComponentBase.trigger (component-base.js:318)
    at TabComponent.select (ej2-navigations.es2015.js:8546)
    at TabComponent.onPropertyChanged (ej2-navigations.es2015.js:8651)
    at TabComponent.dataBind (ej2-base.es2015.js:5502)
    at TabComponent.dataBind (ej2-base.es2015.js:6960)
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)






The error does not happen when i load the page normally(not from routing) or reload the page

1 Reply 1 reply marked as answer

SK Satheesh Kumar Balasubramanian Syncfusion Team May 17, 2021 12:15 PM UTC

Hi Vinay, 
  
Thanks for using Syncfusion Products. 
  
We have validated your reported query and prepared sample to reproduce the reported issue at our end by selecting the tab item using selectedItem property in created event. But, we were unable to reproduce the issue at our end. 

Please find the sample which prepared for your issue - https://stackblitz.com/edit/angular-tab-routing-6dgjia?file=app%2Fapp.component.ts 
  
Could you please share the below details to reproduce the issue? This will help to validate the issue and provide prompt solution as soon as possible. 
  • Share the above sample with modifying code to replicate the issue
  • Share issue replicating sample if possible
  • Share all tab related code snippets along with the Syncfusion NuGet version

Regards, 
Satheesh Kumar B 



Marked as answer
Loader.
Up arrow icon