optomize digest loop

26 views
Skip to first unread message

Berguiga M.Amine

unread,
May 25, 2016, 4:54:17 PM5/25/16
to AngularJS
Hi All, I use Angularjs + Angular material. I create application where I'll able to add tabs dynamically. Each time the user click on the item of an list (item from table) it will show him a new tab with content where the tab-content I'll include a list of template html (I create this list of template inside a component angularjs 1.5). My problem is, when the user open tabX I want that angular digest loop only for the scope on this tab and not $rootScope.digest (in order to optomize my digest loop) because Each tab contain a lot of fields and I will have a problem of performence.

<md-tabs md-dynamic-height>
   <md-tab md-on-select="vm.tabChanger(0)">
      home
    </md-tab-label>
</md-tabs md-dynamic-height>
<md-tab-body class="md-marging">
</md-tab-body>

<tbody>
...
<tr ng-repeat="itemTravail in vm.listTravail" ng-click="vm.eltSelectionner(itemTravail)"  class="row-tab" >
...
</tr>

<md-tab ng-repeat="itemTabs in vm.tabs" >
    <content-page>
       <my-Comp1 onj="vm.object"></my-Comp1>
    </content-page>
</md-tab>




I attached js file of my component. 


loop digest only for my component page and not rootScope ... 

myCom.js

Manish Pal

unread,
May 25, 2016, 10:45:56 PM5/25/16
to AngularJS
ideally, the content of all the tabs should be in ng-if i.e. unless the tab is active, it should be taken out of the DOM. That should solve this problem as well.

Berguiga M.Amine

unread,
May 26, 2016, 12:00:31 AM5/26/16
to AngularJS
@Manish Pal: thank you for your response I'll try it :) 
Reply all
Reply to author
Forward
0 new messages