title: ReferenceError: $ is not defined in Angular JS
body: <p>Hi i am getting 'ReferenceError: $ is not defined' in my code.
  This is my sample code</p>
  
  <pre><code>$rootScope.$on('$stateChangeStart', function (event, next, current) {
          // redirect to login page if not logged in and trying to access a restricted page
          var restrictedPage = $.inArray($state.current.name, ['login']) === -1;
          var loggedIn = $rootScope.globals.currentUser;
          if (restrictedPage &amp;&amp; !loggedIn) {
              $state.go('login');
          }
      });
  </code></pre>
  
  <p>This code am writing inside run();</p>