;
(function () {
'use strict';
angular
.module('shuichan.app.controller', [])
.controller('AppController', AppController);
AppController.$inject = ['$state', '$ionicSideMenuDelegate', 'AuthenticationServiceConstant', 'AuthenticationService'];
/* @ngInject /
function AppController($state, $ionicSideMenuDelegate, AuthenticationServiceConstant, AuthenticationService) {
// jshint validthis: true
var vm = this;
vm.$state = $state;
vm.accessLevels = AuthenticationServiceConstant.accessLevels;
vm.loggingOut = false;
vm.doLogout = doLogout;
///////////////////////
function doLogout() {
vm.loggingOut = true;
AuthenticationService
.logout()
.then(
function (data) {
$ionicSideMenuDelegate.toggleLeft();
vm.$state.go('app.login');
}
)
.finally(
function () {
vm.loggingOut = false;
}
);
}
};
})();
迷茫2017-04-10 17:31:06
John Papa的angular style guide上指view model的意思,具体解释可以看stackoverflow上John Papa的这个回答:http://stackoverflow.com/questions/16619740/angular-should-i-use-this-or-scope/19940503#19940503