Skip to content

Infragistics Community Forum / Web / Ignite UI for Angular / Make tab active at run time

Make tab active at run time

New Discussion
Amit Kohli
Amit Kohli asked on Jul 22, 2019 12:50 PM

Hello,

Below is the HTML setup for the tab component with a template reference variable #notes assigned to one of the tabs.

In the ngOnInit – for certain route parameters, would like to make one of the non-first tabs the active one e.g. –

ngOnInit() {
// debugger;
this.notes.select();
// this.notes.isSelected = true;
}

There is only one router-outlet for the application

<!– operational\components\analyzer\analyzer.component.html –>
<div class=”layout-box-container”>
<div class=”layout-box-top” igxLayout igxLayoutDir=”row”>
<span><a [routerLink]=”””>Operational</a></span>
<span class=”atitle”>Analyzer Diagnostics</span>
</div><!– /.layout-box-top –>

<div class=”tabs” igxLayout igxLayoutDir=”row” igxLayoutJustify=”space-between”>
<igx-tabs style=”width: 100%”>
<igx-tabs-group label=”STREAM” name=”stream”>
<stream></stream>
</igx-tabs-group>

<igx-tabs-group label=”NOTES” name=”notes” #notes>
<notes></notes>
</igx-tabs-group>
</igx-tabs>
</div><!– /.tabs –>
</div><!– /.layout-box-container –>

Thanks and regards,

Amit Kohli

Sign In to post a reply

Replies

  • 0
    Nadia Robakova
    Nadia Robakova answered on Jul 22, 2019 10:56 AM

    Hi Amit,

    If you want to set selected tan on ngOnInit you can use the selectedIndex input of the tab component.

    Here is a sample with this.

    • 0
      Amit Kohli
      Amit Kohli answered on Jul 22, 2019 12:50 PM

      That worked thank you.

      Amit

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Amit Kohli
Favorites
0
Replies
2
Created On
Jul 22, 2019
Last Post
6 years, 7 months ago

Suggested Discussions

Created by

Created on

Jul 22, 2019 12:50 PM

Last activity on

Feb 12, 2026 4:09 PM