Thank you for your reply. I did of course try that first time.. :) Please 
see code below. Not clear what am I missing..

var smartApp = angular.module('smartApp', [
      'ngRoute',
      //'ngAnimate', // this is buggy, jarviswidget will not work with 
ngAnimate :(
      'ui.bootstrap',
      'plunker',
      'app.controllers',
      'app.demoControllers',
      'app.main',
      'app.navigation',
      'app.localize',
      'app.activity',
      'app.smartui',
    'app.f1Controllers',
    'app.f1Services'
]);

smartApp.config(['$routeProvider', '$provide', function($routeProvider, 
$provide) {
    $routeProvider
        .when('/', {
            redirectTo: '/dashboard'
        })

        /* We are loading our views dynamically by passing arguments to the 
location url */

        // A bug in smartwidget with angular (routes not reloading). 
        // We need to reload these pages everytime so widget would work
        // The trick is to add "/" at the end of the view.
        // http://stackoverflow.com/a/17588833

        .when('angular/ui', {
            templateUrl: 'views/angular/ui.html',
            controller: 'PageViewController'
        })

        .when('f1/f1Drivers', {
            templateUrl: 'views/f1/f1Drivers.html',
            controller: 'f1DriversController'
        })

        .when('f1/f1Drivers/:id', {
            templateUrl: 'views/f1/f1Driver.html',
            controller: 'f1DriverController'
        })
/*
        .when('/:page', { // we can enable ngAnimate and implement the fix 
here, but it's a bit laggy
            templateUrl: function($routeParams) {
                return 'views/'+ $routeParams.page +'.html';
            },
            controller: 'PageViewController'
        })
        .when('/:page/:child*', {
            templateUrl: function($routeParams) {
                return 'views/'+ $routeParams.page + '/' + 
$routeParams.child + '.html';
            },
            controller: 'PageViewController'
        })
*/
        .otherwise({
            redirectTo: '/dashboard'
        });

    // with this, you can use $log('Message') same as $log.info('Message');
    $provide.decorator('$log', ['$delegate',
    function($delegate) {
        // create a new function to be returned below as the $log service 
(instead of the $delegate)
        function logger() {
            // if $log fn is called directly, default to "info" message
            logger.info.apply(logger, arguments);
        }

        // add all the $log props into our new logger fn
        angular.extend(logger, $delegate);
        return logger;
    }]); 

}]);

smartApp.run(['$rootScope', 'settings', function($rootScope, settings) {
    settings.currentLang = settings.languages[0]; // en
}])

On Monday, October 6, 2014 2:05:57 PM UTC+8, Sander Elias wrote:
>
> Hi izanywhere,
>
> AngularJS routes work linear, (As do most routing systems!)
> This means, that as soon a path evaluates as valid, that’s the route being 
> used. 
>
> in your case, probably nothing goes behind .when('/:page', ...)
>
> Regards
> Sander
> ​
>
 

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to