2015-05-20 102 views
1

我想更改li:之前的宽度值,并使用变量scope(width)。如何设置li的css:之前使用ng-style

<ul> 
    <li ng-repeat="step in stepsList" ng-style="{li:before { 'width': width;}" 
     ng-class="{true: 'active'}[step.active]"> 
     <span>{{step.stepName | uppercase}}</span> 
    </li> 
</ul> 

我正在做这个代码,但它不工作。请致电 。

+0

你不能。 'style'不适用于伪元素。 –

+0

ngstyle使用inlinestyle,所以它是不可能的http://stackoverflow.com/questions/14141374/using-css-before-and-after-pse- uududo-elements-with-inline-css –

+0

http://stackoverflow.com/questions/20138454/CSS-伪构件在-直列属性式 –

回答

1

不幸的是,您不能在inline stylingpseudoelements。你可以做的是有两个sepparate CSS Classes

.a:before {} 
.b:before {} 

这样,您就可以使用ngClass到适当的类添加到您的HTML

相关问题