import template from './resource-state.html';

const resourceState = {
  template: template,
  bindings: {
    resource: '<'
  },
  controller: class ResourceStateController {
    constructor(resourceUtils) {
      // @ngInject
      this.resourceUtils = resourceUtils;
    }

    $onInit() {
      this.refresh();
    }

    $onChange() {
      this.refresh();
    }

    refresh() {
      this.context = this.resourceUtils.getResourceState(this.resource);
    }
  }
};

export default resourceState;

import template from './resource-state.html';

const resourceState = {
  template: template,
  bindings: {
    resource: '<'
  },
  controller: function ResourceStateController($scope, resourceUtils) {
    $scope.$watch(() => this.resource, () =>
      this.context = resourceUtils.getResourceState(this.resource));
  }
};

export default resourceState;

Fix watcher for resource state.
Fix watcher for resource state.
