Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/willmendesneto/my-angular-route
My angular-route.js file with auto route modification
https://github.com/willmendesneto/my-angular-route
Last synced: about 2 months ago
JSON representation
My angular-route.js file with auto route modification
- Host: GitHub
- URL: https://github.com/willmendesneto/my-angular-route
- Owner: willmendesneto
- Created: 2013-10-23T02:29:12.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-23T03:17:46.000Z (about 11 years ago)
- Last Synced: 2023-03-23T03:36:54.535Z (almost 2 years ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
my-angular-route
================My angular-route.js file with auto route modification
controller definition by route params via ngRoute.
default behaviour:
$routeProvider
// Default call
.when('/main', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.otherwise({ redirectTo: '/error' });behaviour using route params support:
$routeProvider
// Default call
.when('/:section', {
templateUrl: function(req) {
return 'views/' + req.section + '.html';
},
controller: function(req) {
return req.section+ 'Ctrl';
},
autoRoute: true
})
.otherwise({ redirectTo: '/error' });How to use in project (a example of how i use it)
App.js: application routes settings
https://github.com/willmendesneto/angular-architecture/blob/master/app/scripts/app.js
BaseCtrl:how i receive the routeParam method and call it
https://github.com/willmendesneto/angular-architecture/blob/master/app/scripts/controllers/base/base.js