app.config([ '$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise("/login"); $stateProvider.state('login', { url : "/login", templateUrl : "./admin_login.html", controller : 'LoginCtrl' }) }]); app.controller('AppCtrl', [ '$rootScope', '$scope', '$http', '$timeout', '$state', function($rootScope, $scope, $http, $timeout, $state) { $rootScope.goUrl = function(url, ctrl) { $state.go(url); return false; } $rootScope.errorMsg = function(msg) { var d = dialog({ title : '错误提示', content : msg, ok : function() { }, okValue : '确定', width : 350 }); d.showModal(); } $rootScope.dialogMsg = function(msg, fn) { var vFn = fn == undefined ? (function() { }) : fn var d = dialog({ title : '操作提示', content : msg, ok : vFn, okValue : '确定', width : 320 }); d.showModal(); } } ]);