title: Dynamically generate templateURL
body: <p>I am trying to generate templatURL dynamically. I am using angularjs ui-routing</p>
  
  <p>my routing function is: </p>
  
  <pre><code>}).state('error',{
      url: '/:locale/office-profile/',
      templateUrl: function(obj) {
          return 'partials/error-' + obj.locale + '.html';
      }
  </code></pre>
  
  <p>I read other stackoverflow answers where they have said to use such function. What I am trying to achieve is that obj.locale is dynamically populated. I tried to use $stateParams.locale since I thought that url has the locale already but that did not work either.</p>
  
  <p>When I do console.log(obj) it prints <strong>"Object: {locale: null}"</strong> and hence it fails trying to load my template page. </p>
  
  <p>Please advise on what should I do to achieve this. Thank You</p>