javascript - ng-if condition having class name condition -
i using partial view shown below each tab.each partial view has lot of databindings , data rendering becomes slow.
<div class="tab-content" ng-controller="mycontroller"> <div id="tab-1" class="tab-pane fade active in " ng-include="'partialviews/1.html'"></div> <div id="tab-2" class="tab-pane fade" ng-include="'partialviews/2.html'"></div> <div id="tab-3" class="tab-pane fade" ng-include="'partialviews/3.html'"></div> <div id="tab-4" class="tab-pane fade" ng-include="'partialviews/4.html'"></div> <div id="tab-5" class="tab-pane fade" ng-include="'partialviews/5.html'"></div> </div>
in link mentioned
"one approach using ngif wrap inner content separate partial , nginclude. if ngif condition false @ outset, included partial not loaded , evaluated, remove contribution."
so want use ng-if condition based on active tab(active tab have class "tab-pane fade active in"). need ng-if condition based on class name.(i.e ng-if class name "tab-pane fade active in"") didnt how include class name based expression inside ng-if. please help.
you have controller assigned #tab-content. suggest add scope variable keeping track of view active, can either use ng-if
or ng-switch
include necessary views.
set model either using ng-click
(and pass service if navigation under controller) or append routeparameter
, set "activetab" scope variable using that.
Comments
Post a Comment