Advertisement
Guest User

angularjs

a guest
Feb 24th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // js/script.js
  2. 'use strict';
  3.  
  4.  
  5. /**
  6.  * D�claration de l'application routeApp
  7.  */
  8. var routeApp = angular.module('routeApp', [
  9.     // D�pendances du "module"
  10.     'ngRoute',
  11.     'routeAppControllers'
  12. ]);
  13.  
  14. /**
  15.  * Configuration du module principal : routeApp
  16.  */
  17. routeApp.config(['$routeProvider',
  18.     function($routeProvider) {      
  19.    
  20.         // Systeme de routage
  21.         $routeProvider
  22.         .when('/home', {
  23.             templateUrl: 'pages/home.html',
  24.             controller: 'homeCtrl'
  25.         })
  26.         .when('/contact/:msg?', {
  27.             templateUrl: 'pages/contact.html',
  28.             controller: 'contactCtrl'
  29.         })
  30.         .when('/articles', {
  31.             templateUrl: 'pages/articles.html',
  32.             controller: 'articlesCtrl'
  33.         })
  34.         .when('/login', {
  35.             templateUrl: 'pages/login.html',
  36.             controller: 'loginCtrl'
  37.         })
  38.          .when('/register', {
  39.             templateUrl: 'pages/register.html',
  40.             controller: 'registerCtrl'
  41.         })
  42.        
  43.         .otherwise({
  44.             redirectTo: '/home'
  45.         });
  46.     }
  47. ]);
  48.  
  49.  
  50.  
  51. /**
  52.  * défintion des controleurs
  53.  */
  54. var routeAppControllers = angular.module('routeAppControllers', []);
  55.  
  56.  
  57.  
  58.  
  59. // Controleur page articles (chargement des données à partir du fichier file.json)
  60. routeAppControllers.controller('articlesCtrl', ['$scope', '$http', function($scope, $http) {
  61.        
  62.         $http.get('http://localhost:8081/src/servlet/control.do?').success(function(response) {
  63.         $scope.myData = response;
  64.         });                            
  65.         }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement