Jquery 在用户获得授权之前,隐藏前面的某些元素
我在授权方面有问题。在客户端,我使用了这个代码Jquery 在用户获得授权之前,隐藏前面的某些元素,jquery,html,angularjs,Jquery,Html,Angularjs,我在授权方面有问题。在客户端,我使用了这个代码 if (_.isNull(window.localStorage.getItem("username"))) { MEDService.testUser($scope.user) .success(function(data, status, headers, config) { console.log(data); if (data == "OK") { window.loca
if (_.isNull(window.localStorage.getItem("username"))) {
MEDService.testUser($scope.user)
.success(function(data, status, headers, config) {
console.log(data);
if (data == "OK") {
window.localStorage.setItem("username", $scope.user.username);
window.localStorage.setItem("password", $scope.user.password);
$rootScope.user = $scope.user;
$location.path('/');
} else {
alert('Incorrect! Please check your username and password.');
}
在成功登录之前,我想在前面隐藏一些元素。请告诉我怎么做 您需要在控制器范围内设置标志,然后在
ng show
/ng中使用该标志
HTML
<div ng-if="isLoaded">
Content
</div>
好的,我如何使用前面的标志值(真-假)?例如,我想隐藏md sidenav@OlgaK,很高兴能帮助您..谢谢:)谢谢您的评论,但情况越来越糟…在登录div未显示后,您应该添加一些加载图标,而不是具有一定高度的div
。这将间接地告诉用户发生了什么事情代码:菜单
if (_.isNull(window.localStorage.getItem("username"))) {
//before loading set it to false
$scope.isLoaded = false;
MEDService.testUser($scope.user)
.success(function(data, status, headers, config) {
console.log(data);
if (data == "OK") {
window.localStorage.setItem("username", $scope.user.username);
window.localStorage.setItem("password", $scope.user.password);
$rootScope.user = $scope.user;
$scope.isLoaded = true;
//after loaded set it to true
$location.path('/');
} else {
alert('Incorrect! Please check your username and password.');
}