(3)创建 indexController.js
//首页控制器app.controller('indexController',function($scope,loginService){
$scope.showName=function(){ loginService.showName().success(
function(response){
$scope.loginName=response.loginName;
}
);
}
});
(5)修改 home-index.html 引入 js
<script type="text/javascript" src="plugins/angularjs/angular.min.js"></script>
<script type="text/javascript" src="js/base.js"></script>
<script type="text/javascript" src="js/service/loginService.js"></script>
<script type="text/javascript" src="js/controller/indexController.js"></script>
指令,调用方法查询登陆名
<body ng-app="pinyougou" ng-controller="indexController" ng-init="showName()">
显示用户名
<span class="name">{{loginName}}</span>
5.1.1 退出登录
设置退出登录后的跳转地址
<beans:bean id="requestSingleLogoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter">
<beans:constructor-arg value="http://localhost:9100/cas/logout?service=http://localhost:9103"/>
........
</beans:bean>
退出登录后,跳转到网站首页
<span class="safe"> <a href="/logout/cas">退出登录 </a></span>
![](https://s1.51cto.com/images/blog/201810/23/3fb9e0e51c114c3ca10d1c27ea0e5cc9.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
转载于:https://blog.51cto.com/13517854/2307734