Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/409.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS页面刷新_Javascript_Angularjs - Fatal编程技术网

Javascript AngularJS页面刷新

Javascript AngularJS页面刷新,javascript,angularjs,Javascript,Angularjs,我有一个页面,可以调用API来检索数据并显示它。从主页导航到此页面时,一切都正常,但如果按F5键,数据将丢失,只显示绑定{{first_name}} 这是我的控制器: app.controller('examinersCtrl', function($scope, $http) { $http.defaults.useXDomain = true; $http({ method: 'GET', url: 'https://shielded-reac

我有一个页面,可以调用API来检索数据并显示它。从主页导航到此页面时,一切都正常,但如果按F5键,数据将丢失,只显示绑定
{{first_name}}

这是我的控制器:

app.controller('examinersCtrl', function($scope, $http) {
  $http.defaults.useXDomain = true;
  $http({
          method: 'GET',
          url: 'https://shielded-reaches-93856.herokuapp.com/v1/examiners'
       }).success(function(data, status, headers, config) {
            $scope.examiners = data;
       }).error(function(data, status, headers, config) {
            console.log('There was an error getting the data');
       });
   });
});
奇怪的是,http请求只在初始页面加载时发出,而不是在刷新时发出。还有别的办法吗


谢谢

这种事经常发生吗?尝试在私人浏览中进行测试(比如在chrome中隐姓埋名)。还可以在控制器中添加一些console.log,并调查按F5时会发生什么。我在控制器中没有看到范围变量“first\u name”。当我按F5并将console.log放在http请求之外时,它会显示出来,但http请求内不会发生任何事情。表达式实际上应该是{{cormers.first_name}}。实际上,再试一次,当我点击F5时,控制器中似乎没有任何东西运行,只有当我从应用程序中的其他地方导航到该页面时(如主页)。我正在这个应用程序中使用路由,如果这改变了什么…你能不能用小提琴重现这个问题?