jeudi 27 avril 2017

ng-route doesn't owrk with other modules

I have de following code

var balaitus = angular.module("balaitus", ["ngRoute"]);

// configure our routes
balaitus.config(function($routeProvider) {
    $routeProvider
    // route for the home page
        .when('/', {
            templateUrl : 'home_usuario2.html',
            controller  : 'usuarioCtrl'
        })

        .when('/home_usuario', {
            templateUrl : 'home_usuario2.html',
            controller  : 'usuarioCtrl'
        })

        // route for the about page
        .when('/estadisticas', {
            templateUrl : 'estadisticas.html',
            controller  : 'estadisticasCtrl'
        })

        // route for the contact page
        .when('/hashtags', {
            templateUrl : 'hashtags.html',
            controller  : 'hashtagsCtrl'
        })
        .otherwise({
            templateUrl : 'home_usuario2.html',
            controller  : 'usuarioCtrl'
    });
});

// create the controller and inject Angular's $scope
balaitus.controller('usuarioCtrl', function($scope) {
    // create a message to display in our view
    $scope.message = 'Hi! This is the home page.';
});

balaitus.controller('estadisticasCtrl', function($scope) {
    $scope.message = 'Hi! This is the estadisticas page.';
});

balaitus.controller('hashtagsCtrl', function($scope) {
    $scope.message = 'Would you like to contact us?';
});

The code simply routes different pages, and set the corresponding controller. It works fine, but when I add another angular module between [ ], for example ngFileUpload or ui.bootstrap.demo, ng-route doesn't work, ¿but why?




Aucun commentaire:

Enregistrer un commentaire