我们在Web应用程序中有多个页面。我正在使用带有java和angularjs的spring框架..我无法理解如何在不调用控制器的情况下从一个页面导航到另一个页面。任何人都可以帮忙吗?< / p>
答案 0 :(得分:0)
// Code goes here
Below code may help you to redirect you from one page to another page.
(function () {
'use strict';
function LoginController($scope, $log, $location, $http) {
//onSuccess callback....
function onLoginSuccess(res) {
$log.info('Successfully logged in.');
$location.path(NavigationPath.HOME);
}
//onError callback
function onError(error) {
$log.error('Login in failed.', error);
}
/**
* Sign in user after validating the credentials.
*/
$scope.signIn = function () {
$scope.isSigningIn = true;
var formData = {
username: $scope.userName,
password: $scope.password
};
$http.post(formData).then(onLoginSuccess, onError).finally(function () {
//final stuff you can do here
});
};
onLoad();
}
var app = angular.module('app'),
requires = [
'$scope',
'$log',
'$location',
'$http',
LoginController
];
app.controller('LoginController', requires);
}());