11<!doctype html>
22< html lang ="en ">
33< head >
4- < meta charset ="utf-8 "/>
5- < meta http-equiv ="X-UA-Compatible " content ="IE=edge "/>
6- < title > Demo</ title >
7- < meta name ="description " content =""/>
8- < meta name ="viewport " content ="width=device-width "/>
9- < base href ="/ "/>
10- < link rel ="stylesheet " type ="text/css " href ="/webjars/bootstrap/css/bootstrap.min.css "/>
11- < script type ="text/javascript " src ="/webjars/jquery/jquery.min.js "> </ script >
12- < script type ="text/javascript " src ="/webjars/bootstrap/js/bootstrap.min.js "> </ script >
4+ < meta charset ="utf-8 " />
5+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
6+ < title > Demo</ title >
7+ < meta name ="description " content ="" />
8+ < meta name ="viewport " content ="width=device-width " />
9+ < base href ="/ " />
10+ < link rel ="stylesheet " type ="text/css "
11+ href ="/webjars/bootstrap/css/bootstrap.min.css " />
12+ < script type ="text/javascript " src ="/webjars/jquery/jquery.min.js "> </ script >
13+ < script type ="text/javascript "
14+ src ="/webjars/bootstrap/js/bootstrap.min.js "> </ script >
1315</ head >
14- < body >
15- < h1 > Demo</ h1 >
16- < div class ="container "> </ div >
16+ < body ng-app ="app " ng-controller ="home as home ">
17+ < h1 > Login</ h1 >
18+ < div class ="container " ng-show ="!home.authenticated ">
19+ With Facebook: < a href ="/login "> click here</ a >
20+ </ div >
21+ < div class ="container " ng-show ="home.authenticated ">
22+ Logged in as: < span ng-bind ="home.user "> </ span >
23+ </ div >
24+ < script type ="text/javascript " src ="/webjars/angularjs/angular.min.js "> </ script >
25+ < script type ="text/javascript ">
26+ angular . module ( "app" , [ ] ) . controller ( "home" , function ( $http ) {
27+ var self = this ;
28+ $http . get ( "/user" ) . success ( function ( data ) {
29+ self . user = data . userAuthentication . details . name ;
30+ self . authenticated = true ;
31+ } ) . error ( function ( ) {
32+ self . user = "N/A" ;
33+ self . authenticated = false ;
34+ } ) ;
35+ } ) ;
36+ </ script >
1737</ body >
1838</ html >
0 commit comments