Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List of changed files in the modular https://github.com/spring-guides/tut-spring-security-and-angular-js/tree/master/modular project:
- # static/js/home/home.html
- <h1>Welcome</h1>
- <div>
- <p>Hello {{user}}!</p>
- <p><a href="message/link_msg">Show message via URL</a>
- </div>
- # static/js/message/message.js
- var msg = angular.module('message', []);
- msg.controller('message', function($scope, $http) {
- $http.get('/resource/').success(function(data) {
- $scope.greeting = data;
- });
- });
- msg.controller('messageWithRouteParam', ['$scope', '$routeParams', function($scope, $routeParams) {
- $scope.greeting = {id: "no id", content: $routeParams.msg};
- }]);
- # static/js/hello.js
- angular.module('hello', [ 'ngRoute', 'auth', 'home', 'message', 'navigation' ])
- .config(
- function($routeProvider, $httpProvider, $locationProvider) {
- $locationProvider.html5Mode(true);
- $routeProvider.when('/', {
- templateUrl : 'js/home/home.html',
- controller : 'home'
- }).when('/message', {
- templateUrl : 'js/message/message.html',
- controller : 'message'
- }).when('/message/:msg', {
- templateUrl : 'js/message/message.html',
- controller : 'messageWithRouteParam'
- }).when('/login', {
- templateUrl : 'js/navigation/login.html',
- controller : 'navigation'
- }).otherwise('/');
- $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
- }).run(function(auth) {
- // Initialize auth module with the home page and login/logout path
- // respectively
- auth.init('/', '/login', '/logout');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement