Html Ng隐藏不';使用时不起作用<;部门>;标记在一起
我试图使用ng隐藏功能隐藏单选按钮。我面临一个奇怪的问题 当我在div标记中同时使用ng hidesupplierAdminLogs和BuyerAdminLogs时,我的两个单选按钮都会被隐藏,而不仅仅是其中一个 但是,当我移除其中一个ng hide in div标记时,另一个ng hide div标记通过隐藏单选按钮而完美工作。提前谢谢Html Ng隐藏不';使用时不起作用<;部门>;标记在一起,html,angularjs,Html,Angularjs,我试图使用ng隐藏功能隐藏单选按钮。我面临一个奇怪的问题 当我在div标记中同时使用ng hidesupplierAdminLogs和BuyerAdminLogs时,我的两个单选按钮都会被隐藏,而不仅仅是其中一个 但是,当我移除其中一个ng hide in div标记时,另一个ng hide div标记通过隐藏单选按钮而完美工作。提前谢谢 $scope.supplierAdminLogs=function(){//隐藏当前用户登录角色上的供应商/买方单选按钮。 返回true; }; $scop
$scope.supplierAdminLogs=function(){//隐藏当前用户登录角色上的供应商/买方单选按钮。
返回true;
};
$scope.buyerAdminLogs=函数(){
返回true;
};
$scope.adminRole=函数(){
无功电流用户;
if(localStorage.getItem(“currentUser”)!==null){
currentUser=JSON.parse(localStorage.getItem(“currentUser”);
console.log(“已接收”,当前用户);
}否则{
控制台日志(“未收到”);
}
if(当前用户[0]。角色==“供应商管理员”){
$scope.newUser.company=currentUser[0]。公司;
$scope.supplierAdminLogs();//在此处调用函数
返回false;
}else if(当前用户[0]。角色==“买方管理员”){
$scope.newUser.company=currentUser[0]。公司;
$scope.buyerAdminLogs();//在此处调用函数
返回false;
}
};代码>
角色
供应商管理
买方管理员
您可以尝试以下复选框验证:
$scope.user = function(type){
if(type === 'Supplier-Admin'){
$scope.buyerAdminLogs = false;
} else if (type === 'Buyer-Admin'){
$scope.supplierAdminLogs = false;
}
console.log(type)
}
html:
供应商管理
买方管理员
买方管理人
供应商管理日志
尝试将值更改为ng值您的意思是什么?请详细说明。买方管理
与供应商相同-Admin@BartoszTermena不要介意。我解决了。我将supplierAdminLog函数和buyerAdminLog函数移到adminRole函数中的if语句中。现在可以了。谢谢你的帮助:)
<div >
<input type="checkbox"
ng-click="user('Supplier-Admin');supplierAdminLogs = true"
ng-model="supplierAdminLogs"
ng-required="true" ng-value="Supplier-Admin">
Supplier-Admin <br />
</div>
<div >
<input type="checkbox"
ng-click="user('Buyer-Admin');buyerAdminLogs = true"
ng-model="buyerAdminLogs"
ng-required="true" ng-value="Buyer-Admin">
Buyer-Admin <br />
</div>
</div>
</div>
<div ng-if="buyerAdminLogs">buyerAdminLogs</div>
<div ng-if="supplierAdminLogs">supplierAdminLogs</div>