I'm trying to access the current template URL when I change states in the template's controller.
The routes:
lrdcom.config(
function($stateProvider, $urlRouterProvider, $locationProvider, stringUtilsProvider) {
$stateProvider
.state(
'docs',
{
templateUrl: function($stateParams) {
return 'src/pages/' + $stateParams.doc + '.html';
},
url: '/docs/:doc'
}
);
}
);
In the controller, I'd like to know what the templateURL actually returns:
pageViewer.controller(
'pageViewerController',
function($scope, $location, $state) {
// how to get current url of template?
}
);
As in, if the templateURL returned src/pages/mydoc.html how would i get that url from the controller?
I've looked at a number of SO answers suggesting accessing $route, or $state in the controller but I still cannot get it.