0

Angular tab change on new value?

<ul class="nav nav-tabs">
    <li class="active">
        <a class="A" data-target="#A">Nye({{c.data.feil_nye_ant}})</a>
    </li>
    <li class="nav">
        <a class="B" data-target="#B">Aktive({{c.data.feil_aktive_ant}})</a>
    </li>
    <li class="nav">
        <a class="C" data-target="#C">HASTER({{c.data.feil_haster_ant}})</a>
    </li>
    <li class="nav">
        <a class="D" data-target="#D">Ferdige({{c.data.feil_ferdig_ant}})</a>
    </li>
</ul>

Need to draw focus by opening the "HASTER" tab (means "urgent"), when the value of c.data.feil_haster_ant is updated.

1 Answer 1

2

You can use ng-class to make your tabs active. When you perform an event on the tab (like click), set the value of some condition to trigger changes for the css of that tab using ng-class.

HTML:

<ul class="nav nav-tabs">
    <li class="active"  ng-class="{'active': Some condition}">
        <a class="A" data-target="#A">Nye({{c.data.feil_nye_ant}})</a>
    </li>
    <li class="nav"  ng-class="{'active': Some condition}">
        <a class="B" data-target="#B">Aktive({{c.data.feil_aktive_ant}})</a>
    </li>
    <li class="nav"  ng-class="{'active': Some condition}">
        <a class="C" data-target="#C">HASTER({{c.data.feil_haster_ant}})</a>
    </li>
    <li class="nav"  ng-class="{'active': Some condition}">
        <a class="D" data-target="#D">Ferdige({{c.data.feil_ferdig_ant}})</a>
    </li>
</ul>

CSS:

.active{
 your css styles for active tab 
}
Sign up to request clarification or add additional context in comments.

3 Comments

The tab should be switched by the code (not the user), in this case.
Then switch the value in the controller while the trigger happens
Hello Vivz , what can be condition?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.