Click to Edit with AngularJS

Example 1

by madil1548

HTML

<div ng-app="Demo" ng-controller="Sample">
<h3>
Example of Redirect to another page using AngularJS
</h3>
<br>
<br>

  <button ng-click="location()">Click here to see the magic of AngularJS</button>
  
</div>

JavaScript

var app = angular.module('Demo', []);
  app.controller('Sample', function($scope, $window, $location) {
    
    $scope.location = function(){
      
      var url = "https://www.delftstack.com/";
      $window.location.href = url;
    }
  });