title: how to redirect one html page to another using button click event in angularjs
body: <p>i am using angularjs directive to redirect another html page.i am writing click function inside directive but i am getting page name in alert box  not redirect to another html page.</p>
  
  <p>sample.html:</p>
  
  <pre><code>&lt;test1&gt;
  &lt;button data-ng-click="click('/page.html')"&gt;Click&lt;/button&gt;
  &lt;/test1&gt;
  </code></pre>
  
  <p>sample.js:</p>
  
  <pre><code>app.directive('test1',['$location', function(location) {
      function compile(scope, element, attributes,$location) {
           return{
               post:function(scope, element, iAttrs,$location) {
                   scope.click=function(path)
                   { 
                       alert("click"+path);
                       $location.path('/path');
                   };
               }
           };
          }
  
          return({
              compile: compile,
              restrict: 'AE',
          });
  
      }]);
  </code></pre>
  
  <p>i want to redirect page.html how to do this please suggest me.
  Thanks.</p>