angularjs中怎么判断包含
1个回答
展开全部
angularjs中的判断语句说明:
由于angularjs不支持if-else结构,所以判断的写法如下:贺衡
1、用三目运算符:神拍神
<span>{{isLarge ? 'video.large' : 'video.small'}}</span>
2、使用ng-switch结构
<div ng-switch on="video">
<div ng-switch-when="video.large">
</div>
<div ng-switch-default>
<!-- code to render the regular video block -->
</div>
</div>
3、使用ng-if(angularjs 1.1.5以后版本有效):
<div ng-if="video == video.large">游亏
<!-- code to render a large video block-->
</div>
<div ng-if="video != video.large">
<!-- code to render the regular video block -->
</div>
由于angularjs不支持if-else结构,所以判断的写法如下:贺衡
1、用三目运算符:神拍神
<span>{{isLarge ? 'video.large' : 'video.small'}}</span>
2、使用ng-switch结构
<div ng-switch on="video">
<div ng-switch-when="video.large">
</div>
<div ng-switch-default>
<!-- code to render the regular video block -->
</div>
</div>
3、使用ng-if(angularjs 1.1.5以后版本有效):
<div ng-if="video == video.large">游亏
<!-- code to render a large video block-->
</div>
<div ng-if="video != video.large">
<!-- code to render the regular video block -->
</div>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询