title: Will reference $scope object diretctly to service cause Memory leaking? ionic
body: <p>I found that angular service/factory singleton is a great way of sharing data between controllers(to retrieve data or to modify data of one controller from other controllers) . However, if I use it in this way, will I be running into memory leaking situations.</p>
  
  <pre><code>(function () {
    'use strict';
    angular.module('test')
    .factory('cacheService', cacheService);
  
    cacheService.$inject = ['$q'];
  
    function cacheService() {
  
      var cacheObj = {};
  
      var service = {
        set:set,
        get:get
      };
  
      return service;
  
      function set(scopeObject) {
        if(angular.isObject(scopeObject)){
        cacheObj = scopeObject;
        }
      }
  
      function get(){
        return cacheObj;
      }
    }
  })();
  </code></pre>