Javascript ng show不使用布尔值
我正在尝试将几个div与服务值绑定”Javascript ng show不使用布尔值,javascript,html,angularjs,Javascript,Html,Angularjs,我正在尝试将几个div与服务值绑定” {{TopLeftPage}}{{TopRightPage}} {{ButtomRightPage}{{ButtomLeftPage}} 第一组 第二组 第三组 第四组 标签可以很好地显示布尔值,但默认情况下,所有div都隐藏,不管它是真是假。您可以在ng show中直接使用表达式 <div ng-show="TopLeftPage"><h1>Div1 </h1></div> <div ng-show
{{TopLeftPage}}{{TopRightPage}}
{{ButtomRightPage}{{ButtomLeftPage}}
第一组
第二组
第三组
第四组
标签可以很好地显示布尔值,但默认情况下,所有div都隐藏,不管它是真是假。您可以在ng show中直接使用表达式
<div ng-show="TopLeftPage"><h1>Div1 </h1></div>
<div ng-show="TopRightPage"><h1>Div2 </h1></div>
<div ng-show="ButtomRightPage"><h1>Div3 </h1></div>
<div ng-show="ButtomLeftPage"><h1>Div4 </h1></div>
Div1
第二组
第三组
第四组
并确保表达式的值应为true或false boolean而不是string您可以在ng show中直接使用表达式
<div ng-show="TopLeftPage"><h1>Div1 </h1></div>
<div ng-show="TopRightPage"><h1>Div2 </h1></div>
<div ng-show="ButtomRightPage"><h1>Div3 </h1></div>
<div ng-show="ButtomLeftPage"><h1>Div4 </h1></div>
<div ng-show="TopLeftPage"><h1>Div1 </h1></div>
<div ng-show="TopRightPage"><h1>Div2 </h1></div>
<div ng-show="ButtomRightPage"><h1>Div3 </h1></div>
<div ng-show="ButtomLeftPage"><h1>Div4 </h1></div>
Div1
第二组
第三组
第四组
并确保表达式的值应为true或false布尔值,而不是字符串
<div ng-show="TopLeftPage"><h1>Div1 </h1></div>
<div ng-show="TopRightPage"><h1>Div2 </h1></div>
<div ng-show="ButtomRightPage"><h1>Div3 </h1></div>
<div ng-show="ButtomLeftPage"><h1>Div4 </h1></div>
//显示为true,隐藏为false
//对于show为true,对于hide为falseng show已进行角度绑定不需要{{}ng show已进行角度绑定不需要{{}