When I click a link to our 'count' page, I can pass a router parameter with the following code:
$state.go('count', {targetName: object.name})
The router is set up to recognize this parameter in the URL:
url: '/count/:targetName',
We are using the data:
option in UI-Router along with $state
to dynamically adjust page titles:
<title ng-bind="'Application Name : ' + $state.current.data.pageTitle"></title>
I want the pageTitle
to include the :targetName
as well. I attempted to achieve this by setting a function in the data:
property of the router like so:
data: {
pageTitle: function () {
getTargetName.$inject('$stateParams');
function getTargetName ($stateParams) {
return $stateParams.targetName;
}
}
}
However, this approach prevents the page from resolving correctly.
Any suggestions or advice?