我有一个小的 angularjs 应用程序和小路由问题。
$routeProvider.when('/accounts', {templateUrl: 'app/partials/accounts.html', controller: 'accountsListController'});
a href="#/accounts"
这是我的控制器;
appControllers.controller("accountsListController", function($rootScope, $scope, accountsService, Page){ $scope.$emit('START_LOAD'); Page.setTitle("Hesaplar"); $scope.status; $scope.accounts; 获取账户(); 函数 getAccounts() { accountsService.getAccounts() .成功(函数(accs){ $scope.accounts = accs.accounts; $scope.$emit('STOP_LOAD'); }) .error(函数(错误){ $scope.status = '无法加载账户数据:' + error.message; }); } });
当我第一次单击 /accounts 链接时,我的控件、休息请求......一切都完美加载。但是,在同一条路线上,我再次单击 /accounts 链接,没有重新加载或触发。
所有路由请求一次工作,不刷新,示例小提琴http://jsfiddle.net/munsal/BUg8L/11/
我在哪里做错了?
(对不起我的英语不好)