Is there a way to access $stateParams without using a <ui-view>
tag in the HTML?
I'm trying to make this code function properly:
.config([
'$locationProvider',
'$stateProvider',
function($locationProvider, $stateProvider) {
$locationProvider.html5Mode(true);
$stateProvider
.state('schedules_show', {
name: 'edit_schedule',
url: '/schedules/:id/edit'
});
}])
I need to retrieve the :id parameter from any controller called through $stateParams.
Further clarification: I don't want to utilize $stateParams for navigation purposes as my application combines RoR and Angular.js. View transitions are handled server-side with regular links. My goal is simply to use angular-ui-router to extract specific values like :id from the URL to use within my Angular.js portion of the app. This means I do not want to navigate using Angular or rely on its state-dependent controllers/views, hence why I prefer not to have <ui-view>
tags in my HTML.
Solution found: After reevaluating my approach with angular-ui-router
, I've come up with a workaround involving passing parameters from the HTML using ng-init to the controller. Although this resolves my immediate issue, it does not completely address my original question, so I believe this matter should be closed.