authType은 login api에서 가져 오는 "basicUser"또는 "adUser"가 될 수 있습니다.Angularjs ng-show 값을 API 데이터와 동일하게 처리하는 방법
사용자 창이 API/로그인 및 config.js (미안이 논리 혼란 스러워요)의 비교를 기반으로 표시됩니다. confic.js 파일의 authType 가용성을 기반으로보기 섹션을 갖습니다.
예 :
{
"authorities": [
{
"authtype": "basicUser",
"token": {
"id": "wTLtMHbIVlKNQoR2htY3LQFlpt4ED3BLKxw",
"isvalid": true
},
"user": {
"id": "admin",
"name": "Administrator",
}
}
]
}
예 ../api/login : myconfig.js
{
"authType":{
"basicUser":"basicUser",
"adUser":"adUser",
}
}
view.html
<div ng-controller="userCntrl" ng-show="authType === {{authType.basicUser}}"></div>
<div ng-controller="userCntrl" ng-show="authType === {{authType.adUser}}"></div>
이것을 기반으로 ng-show = "authType === basicUser"가 표시되지만 예상 출력은 따옴표 ('') 여야합니다.
<div ng-controller="userDialogController" ng-show="authType === 'basicUser'"></div>
는 "=== authType이 authType.basicUser를"=이'NG-쇼를 시도 NG-쇼에서 표현을 사용하지 않는 코드를 시도 {{}}에서 각도 지시문 –
표현식을''''로 묶을 수 있습니다. ng-show = "authType === authType.basicUser"를 사용하면 [여기] (https://jsfiddle.net/Kunalh/04885499/10/) – Nishant123
@ Angular_10을 참조하십시오. 그러면 ng-show = "authType === 'basicUser'"내가 언급 한 바와 같이 –