I seem to be using ngRoute incorrectly for some reason. I am basically
extending/conbining 2 projects obtained from the net, SmartAdmin and
F1Feeder. The idea is to then customize the SmartAdmin portal for a
specific application.
Any idea why the f1Driver routers below are never used, assuming all the
other configs are correctly set up?
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('/: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'
})
.when('angular/ui', {
templateUrl: 'views/angular/ui.html',
controller: 'PageViewController'
})
.when('ex_F1/f1Drivers', {
templateUrl: 'views/ex_F1/f1Drivers.html',
controller: 'f1DriversController'
})
.when('ex_F1/f1Drivers/f1Driver/:id', {
templateUrl: 'views/ex_F1/f1Driver.html',
controller: 'f1DriverController'
})
.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
}])
--
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.