How can use the optional parameter from my angular route in the title.
So I want textToSearch
to appear in the title:
.when('/search/:textToSearch',
{
title: 'Searching' + textToSearch,
templateUrl: 'views/search.html',
controller: 'searchController'
}
)
And i'm setting title in routeChangeSuccess:
$rootScope.$on('$routeChangeSuccess', function() {
//Set the <title> tag
if (!$route.current.title) {
document.title = 'Default Generic Title';
} else {
document.title = $route.current.title;
}
}