Javascript AngularJs$mddialog如何在每次单击templateurl时重新加载内容?

Javascript AngularJs$mddialog如何在每次单击templateurl时重新加载内容?,javascript,angularjs,Javascript,Angularjs,每次单击执行$scope.showAdvanced的按钮时,mddialog的内容都保持不变,即使我更改了post.html的内容。我甚至尝试清除缓存(shift+f5),但内容仍然是旧的 var CardAng=angular.module('CardAng',['ngMaterial','ngMessages']); CardAng.controller('AppCtrl', function($scope,$mdDialog){ $scope.imagePat

每次单击执行$scope.showAdvanced的按钮时,mddialog的内容都保持不变,即使我更改了post.html的内容。我甚至尝试清除缓存(shift+f5),但内容仍然是旧的

var CardAng=angular.module('CardAng',['ngMaterial','ngMessages']);


    CardAng.controller('AppCtrl', function($scope,$mdDialog){

        $scope.imagePath="img/IMG1.jpg";


        $scope.showAdvanced = function(ev) {
            $mdDialog.show({
              controller: DialogController,
              templateUrl: '/post.html',
              parent: angular.element(document.body),
              targetEvent: ev,
              clickOutsideToClose:true,
              fullscreen: $scope.customFullscreen // Only for -xs, -sm breakpoints.
            })
            .then(function(answer) {
              $scope.status = 'You said the information was "' + answer + '".';
            }, function() {
              $scope.status = 'You cancelled the dialog.';
            });
          };

     function DialogController($scope, $mdDialog) {

        $scope.hide = function() {
          $mdDialog.hide();
        };

        $scope.cancel = function() {
          $mdDialog.cancel();
        };

        $scope.answer = function(answer) {
          $mdDialog.hide(answer);
        };
      }

    });

AngularJS拥有自己的
$templateCache
。 试着清除它


$templateCache.remove('/post.html')
$templateCache.removeAll()

是否任何方法都可以清除缓存或更新模板而无需刷新(f5)?此缓存不需要f5。只需在显示目标模板之前清除它。请小心,浏览器可以缓存它,所以您应该提供适当的后端缓存头