复杂的角度JS纳克级 [英] Complex angular js ng-class

查看:124
本文介绍了复杂的角度JS纳克级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有分量和有问题的CSS类设置它。
我想它总有一类盒子,再到具有由指令类的说法,一个有条件的类迷你。

I have the component and have a problem setting the css class to it. I want it to always have a class of "box", then to have additional classes specified by the directive "class" argument and one conditional class "mini".

我概念想达到的目标是这样的:

Conceptually what I want to achieve is something like this:

<div class="box {{class}}" data-ng-class="{mini: !isMaximized}">
...
</div>

问题是,当我设置类HTML属性,省略了NG-class属性。
如何使不改变控制我的示例工作?它甚至有可能,还是应该设置类控制器,而不是(我想避免)?

The problem is that when I set the class html attribute, the ng-class attribute is omitted. How to make my example work without changing the controller? Is it even possible, or should I set the class in the controller instead (which I wish to avoid)?

推荐答案

我需要的地方一人$范围派生和其他人的文字类的多个类。感谢来自安德烈提示,以下为我工作。

I needed multiple classes where one was $scope derived and others were literal classes. Thanks to the hint from Andre, below worked for me.

<h2 class="{{workStream.LatestBuildStatus}}" 
    ng-class="{'expandedIcon':workStream.isVisible,  'collapsedIcon':!workstream.isvisible}">{{workStream.Name}}</h2>

这篇关于复杂的角度JS纳克级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆