I have a view where I have the following code:
T
According to https://github.com/angular-ui/ui-router/wiki/Quick-Reference#note-about-using-state-within-a-template you can add it to $rootScope, so it will be available in all the scopes and hence all the templates, by
angular.module("myApp").run(function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
});