Hi

 

In my application(1.3.17 version), we have lot of dropdowns in HTML Pages 
which were created as a part of custom directive(Here the drop down is 
created with the help of custom directive). The data in the dropdowns are 
being filled with the data which we receive as a part of Rest API Call. We 
observed that when we navigate from page which contains drop down to home 
page , we see that memory is still being held by the references and thus 
causing lot of memory leak. 

 

Please find details below :

 

1)File from where custom dropdown will be called :

 

< customDropDown value="request.getID" list="getID"></ customDropDown >

 

2)customDropDown.directive.js:

 

function customDropDown() {

      return {

        restrict: 'E',

        scope: {

          id: '@',

          list: '@',

          value: '=',

          form: '=',

          disabled: '@',

          empty: '@'

        },

        templateUrl: 'customDropDown.html',

        controller: function($scope, $rootScope) {

          $scope.disabled = $scope.disabled ? ($scope.disabled === 'true') 
: false;

          $scope.empty = $scope.empty ? ($scope.empty === 'true') : true;

          $scope.model = {value: $scope.value };

          

                               //Instead of APi call, I am just Hard Coding 
couple of value ("List" as query parameter in API Call and the data which 
we receive will be huge

                               

                              $scope.item= 
{"id":1,"name":"one","value":"one"},{"id":2,"name":"two","value":"two"},{"id":3,"name":"three","value":"three"};

                             

            

          });

        }

      };

    }

 

  })();

 

 

3)customDropDown.html:

 

<select  id="{{id}}" name="{{id}}" class="form-control" 
ng-model="model.value" ng-options="item.id as item.name for item in items | 
unique:'name'" {{required}} ng-disabled="{{disabled}}"><option value="" 
ng-show="{{empty}}"></option></select>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to