HI --
I'm fairly new to Angular, so this is probably a pretty easy question! Any
help is very much appreciated.
My application is designed to be duplicated and deployed on multiple web
sites, while accessing the same database via AJAX using CORS.
The sites will skin it however they like (and it's possible for them to
modify some of the code).
However, if they deploy it on their site, some of the values that I
currently have in $routeProvider need to be hard-coded. The current
$routeProvider looks like this:
$routeProvider
.when('/', {templateUrl: '/static/rideshares/views/regions.html',
controller: 'HomeController'})
.when('/:region', {templateUrl:
'/static/rideshares/views/regions.html', controller: 'HomeController'})
.when('/:region/:event', {templateUrl:
'/static/rideshares/views/home.html', controller: 'EventHomeController'})
.when('/:region/:event/:rf', {templateUrl:
'/static/rideshares/views/home.html', controller: 'EventHomeController'})
.when('/:region/:event/:rf/search', {templateUrl:
'/static/rideshares/views/search.html', controller: 'SearchController'})
.when('/:region/:event/:rf/find', {templateUrl:
'/static/rideshares/views/find.html', controller: 'FindController'})
.when('/:region/:event/:rf/contact/:rsid', {templateUrl:
'/static/rideshares/views/contact.html', controller: 'ContactController'})
.when('/:region/:event/:rf/detail/:id', {templateUrl:
'/static/rideshares/views/detail.html', controller: 'DetailController'})
.when('/:region/:event/:rf/create', {templateUrl:
'/static/rideshares/views/add.html', controller: 'CreateController'})
.when('/:region/:event/:rf/edit/:id', {templateUrl:
'/static/rideshares/views/add.html', controller: 'CreateController'})
.otherwise({templateUrl: '/static/rideshares/views/error.html',
controller: 'HomeController'})
It's as if I want to "pin" it at some point in the url, like "/:region" or
"/:region/:event" so that that those parameters are fixed to a particular
value for that site.
In part, this is so that the Home button goes to the correct place and not
all the way back to '/'.
I also want the user to be able to bookmark certain pages (in particular
the /:region/:event/:rf/detail/:id page, but ideally all of them).
The way I currently have it is using a service ("Nav") that looks at
$routeParams and $location and sets the correct currentHome but that seems
kind of clunky.
I've considered putting the region, event and rf vars directly into the
$rootScope in the run() method. But that doesn't seem right either, since
the top-level version of the application can access all the different
regions and events.
Is this making any sense? It's like sometimes I want to use a fixed value
for the :region and sometimes I want it to be paramaterized, but I don't
see quite how to set up routes for both those situations.
Thanks for pointing me in the right direction!
--
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.