0

I got an entity with 2 properties x and y, y is calculated on server side after every save, the problem is in ui, when editing x and click save, y value is changed on server, but change is not reflecting in client side.

Is there a way to tell ng-admin, to reload entire entity?

Chen Kinnrot
  • 20,609
  • 17
  • 79
  • 141

1 Answers1

1

There is a hackish way to do it, explained in ng-admin issue 805:

angular.module('crud')
.config([
'$provide', function ($provide) {
  $provide.decorator('WriteQueries', [
    '$delegate',
    '$state',
    function ($delegate, $state) {
      var originalUpdateOne = $delegate.updateOne;
      $delegate.updateOne = function () {
        return originalUpdateOne.apply($delegate, arguments).
          then(function () {
            $state.reload()
          });
      };
      return $delegate;
    }]);
 }
]);

A more elegant way will result from the implementation of ng-admin issue 777

François Zaninotto
  • 7,068
  • 2
  • 35
  • 56