0

Is there any possibility to call "dashboard.html" without using <a href="#!dashboard">Some text</a>? I wont to call "dashboard.html" from javascript.

app.config(function($routeProvider) {
  $routeProvider
  .when('/', {
    templateUrl : 'loginRegister.html',
    controller : 'loginRegister'
  })
.when('/dashboard', {
    templateUrl : 'dashboard.html',
    controller : 'dashboard'
  })
})

app.controller('loginRegister', function($scope, $http) {
    $scope.showDashboard = function() {
         // CALL dashboard.html FROM HERE
    }
})
Marek
  • 27
  • 5

2 Answers2

0

You can use the location function https://docs.angularjs.org/guide/$location

OR you can use the $window inside AngularJS controller

$window.location.href = '/index.html';

It think you will have a complete response here How to redirect to another page using Angular JS?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
sheplu
  • 2,937
  • 3
  • 24
  • 21
0

this is the code for redirecting in angular js app

$location.path('/dashboard');
mygeea
  • 463
  • 3
  • 10