にログインページからHederを非表示にする方法を私は、ログインpage.Myインデックスページからヘッダーを非表示にするangularjs
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="CourseController">
<div class="row">
<div class="col-lg-9">
<div class="container-fluid" >
<div class="row">
<div class="col-xs-12 col-lg-2">
<div class="main_logo"><img src="../app/image/track_logo.jpg" style="margin-top: 8px;" /> </div>
</div>
<div class="col-xs-12 col-lg-8">
<div class="navbar-header">
<span class="rsp_menu hidden-sm hidden-md hidden-lg" style="color:#fff; font-weight: bold; float: left; padding: 15px 14px;"> Menu</span>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Menu</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
</div>
<div class="collapse navbar-collapse bk_menu" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav" style="margin:0;">
<li class="dropdown mn_dp">
<a href="#" class="dropdown-toggle">
Student List <b class="caret">
</b>
</a>
<ul class="dropdown-menu">
<!--<a ui-sref="Home" ID="Link_search" style="color:White;font-family:FangSong;font-size:15px;padding:8px;margin-left:7px;"
Width="61px" Height="22px"
ng-show="false">Activity</a>-->
<li><a ui-sref="Candidate Registration">Create New</a></li>
<li><a ui-sref="StudentList">Student List</a></li>
</ul>
</li>
<li class="dropdown mn_dp">
<a href="#" class="dropdown-toggle">
Report <b class="caret">
</b>
</a>
<ul class="dropdown-menu">
<li><a ui-sref="Home1">Follow Up Report</a></li>
<li><a ui-sref="Home1">Dashboard </a></li>
<li><a ui-sref="Home1">Login Report</a></li>
</ul>
</li>
<li class="dropdown mn_dp">
<a href="#" class="dropdown-toggle">
Settings <b class="caret">
</b>
</a>
<ul class="dropdown-menu">
<li><a ui-sref="Home1"> Country</a></li>
<li><a ui-sref="Home1">Level </a></li>
<li><a ui-sref="Home1">Department</a></li>
<li><a ui-sref="Home1">Course</a></li>
</ul>
</li>
</ul>
</div>
</div><div class="col-lg-2 bk_hd_rgt">
<p style="color:#fff;"><img src="../app/image/bk_admin.jpg"> {{uname}}</p>
<!--<p style="color:#fff;"> Name</p>-->
<p style="color:#fff;float:right"><a ui-sref="Authentication"><i class="fa fa-sign-out fa-fw"></i> Logout</a> </p>
</div>
{{uname}}
</div>
</div>
</div>
ですそして、私のログインページが
<div id="login" ng-controller="authController">
<form class="form-3 bgimg body" ng-keypress="checkIfEnterKeyWasPressed($event)">
<p class="clearfix">
</p>
<p class="clearfix">
</p>
<br />
<p class="clearfix">
</p>
<br />
<center>
<p class="clearfix">
<input type="text" required="" id="login" ng-model="login" ng-minlength="1" ng-maxlength="30"
placeholder="Username" size="50" autofocus />
</p>
<p class="clearfix">
<input type="password" required="" ng-model="password" ng-minlength="1" ng-maxlength="30" id="password"
placeholder="Password" size="50" ng-keypress="checkIfEnterKeyWasPressed($event)" />
</p>
<br />
<button class="btn btn-success" id="btn_login" ng-click="submit()">Login</button>
<button type="button" class="btn btn-danger" ng-click="cancel()">Cancel</button>
</center>
</form>
です
私のコントローラは、私は、ログインページ.AND dispaly loginedユーザー名optherページから見出しを非表示にする
MyApp.controller('authController', function ($scope, $cookies, $state, $interval, $resource, $http, masterdataFactory) {
//console.log("Auth" + $rootScope);
var Authentication;
sessionStorage.clear();
var Total;
var user;
var flagval;
$scope.login = $cookies.get('Uname');
$scope.password = $cookies.get('Password');
if ($scope.login != null) {
$scope.rememberme = true;
document.getElementById("btn_login").focus();
}
$scope.username = $scope.login;
$scope.Pswrd = $scope.password;
function IsAuthenticate(username, Pswrd) {
debugger;
masterdataFactory.IsAuthenticated(username, Pswrd)
.success(function (data) {
debugger;
if (data.length !== 0) {
sessionStorage.setItem("uname", $scope.login);
$state.go('StudentList');
if ($scope.rememberme == true) {
$cookies.put('Uname', $scope.login);
$cookies.put('Password', $scope.password);
$cookies.put('check', true)
}
else {
$cookies.remove('Uname');
$cookies.remove('Password');
$cookies.remove('check');
}
}
else {
if ($scope.login != null && $scope.password != null) {
toastr.error("Invalid User Name/Password");
$scope.login = null;
$scope.password = null;
}
$state.go('Authentication');
}
console.log($scope.courses)
})
.error(function (error) {
$scope.status = 'Unable to load countries data: ' + error.message;
});
}
$scope.checkIfEnterKeyWasPressed = function ($event) {
var keyCode = $event.which || $event.keyCode;
if (keyCode === 13) {
if ($scope.login === "") {
if ($scope.password == "") {
$scope.login = null;
$scope.password = null;
}
}
if ($scope.login != "") {
if ($scope.password != "") {
flagval = 1;
}
}
IsAuthenticate($scope.login, $scope.password);
}
};
$scope.cancel = function() {
$scope.login = "";
$scope.password = "";
document.getElementById("password").focus();
};
$scope.submit = function() {
if ($scope.login === "") {
if ($scope.password == "") {
$scope.login = null;
$scope.password = null;
}
}
if ($scope.login != "") {
if ($scope.password != "") {
flagval = 1;
}
}
IsAuthenticate($scope.login, $scope.password);
};
});
です。どのように働いて私を助けることができますか?
あなたはmeann ng- hide.iセットNG-ショー= "変数"。 true/falseを私のログインpart.Inで私のログインコントローラ$スコープ、変数= falseを設定し、認証が成功した場合私はそれをtrueに設定します。変数はtrueになりますが、ヘッダーは表示されません –