$urlRouterProvider.otherwise is not a function
<p>I have this <strong>app.js</strong> file</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>angular.module('myApp', [
  'myApp.version',
    'ui.router'
]).
config(['$locationProvider','$urlRouterProvider','$stateProvider', function($locationProvider,$stateProvider, $urlRouterProvider, $httpProvider) {

   $urlRouterProvider.otherwise('/view1');
        

  $stateProvider
      .state('view1', {
        url: '/view1',
        templateUrl: 'partials/view1.html'
        //controller: 'view1.MainController'
      })
      .state('view2', {
        url: '/view2',
        templateUrl: 'partials/view2.html'
      })

      .state('view3', {
        url: '/view3',
        templateUrl: 'partials/view3.html'
      })

      .state('view4', {
        url: '/view4',
        templateUrl: 'partials/view4.html'
      });
}]);</code></pre>
</div>
</div>
</p>

<p>I have included "<a href="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.min.js" rel="nofollow noreferrer">https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.min.js</a>" CDN in my index.html file and it is getting loaded fine.</p>

<p>But even when it is loaded the console is giving an error as </p>

<p><strong>Failed to instantiate module myApp due to:
TypeError: $urlRouterProvider.otherwise is not a function</strong></p>

<p>I tried removing this line and then test the code, but then it gives </p>

<p><strong>Failed to instantiate module myApp due to:
TypeError: $stateProvider.state is not a function</strong></p>

<p>I have gone through the code multiple times but I am unable to identify the mistake/error.</p>

<p>(angular version is 1.5.8 and angular-ui-router version is 0.3.1 ,if that helps)</p>

<p>Please Help!</p>