Ng-animate stopped working using $templateRequest decorator

后端 未结 1 879
[愿得一人]
[愿得一人] 2021-01-13 04:47

I was trying to avoid template errors with angular js when my user became unauthenticated. To do this, I came to this stackoverflow solution.

It worked for me, but n

1条回答
  •  孤城傲影
    2021-01-13 05:32

    The function $templateRequest contains additional properties that are used internally. You need to move these properties to the new function.

    Here is an implementation that should work:

    app.config(['$provide', function($provide) {
      $provide.decorator('$templateRequest', ['$delegate', function($delegate) {
    
        var fn = $delegate;
    
        $delegate = function(tpl) {
    
          for (var key in fn) {
            $delegate[key] = fn[key];
          }
    
          return fn.apply(this, [tpl, true]);
        };
    
        return $delegate;
      }]);
    }]);
    

    0 讨论(0)
提交回复
热议问题