anthtrigger
Version:
Trigger events via http service
30 lines (27 loc) • 935 B
JavaScript
(function() {
angular.module('anthTrigger').controller('dashboardController', function($rootScope, $scope, $cookies, $http, $location, notify) {
var loadStatistic;
loadStatistic = function() {
return $http.get('/dashboard/stats').success(function(resp) {
return $scope.stat = resp.data;
}).error(function() {});
};
loadStatistic();
$scope.login = function(user) {
return $http.post('/login', user).success(function(result) {
if (result.success) {
notify.closeAll();
$cookies.uid = result.user._id;
return $rootScope.ReloadCurrentUser();
} else {
return notify("登陆失败!");
}
}).error(function() {
return notify("登陆失败,服务器错误!");
})["finally"](function() {
return loadStatistic();
});
};
});
}).call(this);
//# sourceMappingURL=dashboardController.js.map