02/12/2017 Development / java script

angular.module('myUtils', [])
.factory('$Utils', ['$rootScope', function($rootScope){

  this._$scope = $rootScope;

  var NormalizedCollection = (ref, childKey, keyValue, obj) => {
    ref.child(childKey).once('value').then(resp => {
        obj[keyValue] = resp.val();
        this._$scope.$apply();
    });
  };

  return {
    NormalizedCollection : NormalizedCollection
  };
}]);

angular.module('MyOtherApp', ['myUtils']);

export class MyController {
  constructor ($Utils) {}
}