ic-switch-class - The Switch Class Attribute

Summary

The ic-switch-class attribute allows you to switch classes between elements after a response has been received. This allows you to for example update a tab state without replacing the tabs in the server response.

Syntax

The value of this attribute should be the name of the class to be switched between sibling elements and the attribute should be placed on the parent element.

Dependencies

The ic-switch-class attribute has no effect on dependencies.

Example

Here is a simple bootstrap tab example. Note that the body of the tabbed UI is replaced with new HTML, but the tabs are not, since we are targeting #content. The tabs update based on switching the class active between them.

        <ul class="nav nav-tabs" ic-target="#content" ic-switch-class="active">
          <li class="active"><a ic-get-from="/tab1">Tab1</a></li>
          <li><a ic-get-from="/tab2">Tab2</a></li>
          <li><a ic-get-from="/tab3">Tab3</a></li>
        </ul>
        <div id="content">
          Tab 1
        </div>
      
Tab 1