https://github.com/rktjmp/atlas
AngularJS Named Route Service
https://github.com/rktjmp/atlas
Last synced: 7 months ago
JSON representation
AngularJS Named Route Service
- Host: GitHub
- URL: https://github.com/rktjmp/atlas
- Owner: rktjmp
- License: gpl-2.0
- Created: 2013-07-19T07:22:34.000Z (about 12 years ago)
- Default Branch: develop
- Last Pushed: 2013-07-22T04:42:34.000Z (about 12 years ago)
- Last Synced: 2025-01-27T08:25:00.936Z (8 months ago)
- Language: CoffeeScript
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Atlas
=====Atlas is a naive AngularJS service that allows you to access your application routes
by a given name and inject any url parameters.Usage
-----In your routes, you have to define a the route name by adding the key "atlasName",
as shown below:$routeProvider.when('/my-albums/:album/:photoid/comments, {
atlasName: "album-photo-comments",
controller: 'AlbumController',
}).when("/home", {
atlasName: "home",
controller: "HomeController"
})In your main app definition, add Atlas as a dependency:
window.app = angular.module('myApp', ['Atlas']).config(...)
Now in your controllers you can use use Atlas like so:
Go to a route with no parameters:
$scope.goHome = () -> Atlas.goto('home')
Go to a route with parameters, the object keys must match the route param keys:
$scope.gotoAlbumPhotoComments = (album, photo) -> Atlas.goto('album-photo-comments', {
album: album,
photoid: photo
})