私は、authTypeがログインAPIから取得する "basicUser"または "adUser"のいずれかのシナリオを持っています。Angularjs ng-show値の扱い方はAPIデータと同じです
Userウィンドウが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>
を表現を使用していないこのコードを試してみてくださいangleディレクティブ –
式を ''''の中で囲むことができます。 ng-show = "authType === authType.basicUser"を使用している場合は、[here](https://jsfiddle.net/Kunalh/04885499/10/) – Nishant123
@ Angular_10を参照してください。 "authType === 'basicUser'"私が述べたように –