Github user corneadoug commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/389#issuecomment-157601761
  
    @babokim 
    That's not exactly how it should be used, the goal is to use it as a data 
storage.
    Let's say you have a similar DataFactory as the one I gave in example:
    ```
    angular.module('zeppelinWebApp').factory('systemConfDataFactory', 
function() {
      var vm = {};
    
      vm.conf = {};
    
      vm.setSystemConf = function(systemConf) {
        vm.conf = angular.copy(systemConf);
      };
      return vm;
    });
    ```
    
    Then you just have to call ``setSystemConf`` in your websocketEvents like 
this:
    ```
    angular.module('zeppelinWebApp').factory('websocketEvents', function ( ..., 
 systemConfDataFactory) {
      websocketCalls.ws.onMessage(function(event) {
        ...
        } else if (op === 'GET_SYSTEM_CONF') {
          systemConfDataFactory.setSystemConf(data.conf);
        }
      }
    }
    
    ```
    
    And when you need to do some ng-if or ng-hide, you can do like this:
    ``home.controller``
    ```
     angular.module('zeppelinWebApp').controller('HomeCtrl', function(..., 
systemConfDataFactory) {
       vm.conf = systemConfDataFactory;
    ```
    
    ``home.html``
    ```
    
    <h5 ng-hide="home.conf.readonly">
      <a href="" data-toggle="modal" data-target="#noteNameModal" 
style="text-decoration: none;">
        <i style="font-size: 15px;" class="icon-notebook"></i> Create new 
note</a>
    </h5>
    
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to