How do I edit the width of a class using angularjs?

2

I have an element with two classes:

 <div class="classe1 classe2">

 </div>

I want to increase the width of my class 2 style, what would be the right way to do it?

    
asked by anonymous 04.08.2015 / 07:13

2 answers

4

One of the correct ways to do this is to give the correct width to a new class, widthClass (for example) and then make a ng-class .

widthClass { width: 9000px }

<div ng-class="'widthClass': scope.needsMoreWidth" class="class1 class2"></div>

In your controller you will have something like:

$scope.needsMoreWidth = true;

    
04.08.2015 / 16:16
2

If you want to apply width to all elements that apply to the class, in the "class2" case, at runtime, you can apply.

angular.element(".class2").width(500)

    
11.08.2015 / 22:36