在用户登录后,我希望他看到一个写着“Hello”+他的名字的页面。对于将他重定向到页面,我使用以下方法:
angular.
module('myApp').
config(['$locationProvider', '$routeProvider',
function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routeProvider.
when('/loginPage',{
template: '<login-page></login-page >'
}).
when('/user-issue', {
resolve: {
"check":function($location,$rootScope){
if(!$rootScope.stat){
$location.path('/');
}
}
},
template: '<user-issue></user-issue>'
}).
otherwise({redirectTo: '/loginPage'});
}]);如何将他的名字的值从loginPage.js传递到userIssue.js页面?我试着在LoginPage中使用LoginPage来让它在userIssue中使用,但这是行不通的。
发布于 2017-03-24 16:49:44
您可以通过使用$routeParams将用户名作为参数传递到要重定向到的路由。
https://stackoverflow.com/questions/43004911
复制相似问题