Change page with angularjs

hi everyone,
how can i change the page(.html) after clicking on button, i thin that i can do it with ng-click but i don’t know how.
please help me :blush: thanks :wink:

Hi jobout,

There are a few ways this can be accomplished.

Here is a $stateProvider state that will go in your app.js file for reference:
.state(‘login’, {
url: ‘/login’,
templateUrl: ‘templates/login.html’,
controller: ‘LoginCtrl’
})

#1 href - pass in url
Login

#2 ui-sref - pass in your $stateProvider state
Login

#3 ng-click - pass in a function that will use $window and the page’s url
Login

  and in the SignupCtrl:
  .controller('SignupCtrl',  ['$rootScope', '$scope', '$window',
        function($rootScope, $scope, $window) {

            $scope.login = function() {
                $window.location.assign('#/login');
            };
        }
   ]);

There are probably more ways but here are three. Let me know if you have more questions.

1 Like

YOU ARE THE GREATEST!! Thanks…