0
我正在开发使用angular
的nodejs
应用程序。在这里我只是与以下场景混淆。我需要最好的做法知道处理这一切:如何以正确的标准处理`角度路线“中的不同场景?
在route
- 如何显示某些页面,无需验证?
- 如何仅在认证成功后显示其他页面?
- 如何重新指向错误的URL(这不在应用程序中) - 没有身份验证?
- 如何在身份验证后将错误的URL重定向到主页或背页?
所有这种情况都是在fronend或后端处理?否则这是正确的方式?
这里是样本:
决不需要测试验证:
.when('/login', {
templateUrl : 'app/views/pages/login.html',
controller : 'mainController',
controllerAs: 'login'
})
.when('/login', {
templateUrl : 'app/views/pages/createUser.html',
controller : 'userController',
controllerAs: 'user'
})
总是需要身份验证:
.when('/login', {
templateUrl : 'app/views/pages/showProduct.html',
controller : 'productController',
controllerAs: 'product'
})
.when('/login', {
templateUrl : 'app/views/pages/showStatics.html',
controller : 'staticController',
controllerAs: 'static'
})
与错误的URL验证之前:
.when('/login', {
templateUrl : 'app/views/pages/testingWrong'
})
经过错误URL验证后:
.when('/static', {
templateUrl : 'app/views/pages/showStatics.html',
controller : 'staticController',
controllerAs: 'static'
})
.when('/static/wrong', {
templateUrl : 'app/views/pages/showStatics.html',
})
如果有教程,请分享我。或者如果有解决方案,请发帖详细了解。
在此先感谢。
是的,同意。如果URL错误,情况会是怎样? – user2024080
对不起,我没有得到你。 如果URL错误,则执行其他功能 –