2

How can I toggle the Bootstrap 3 grid system column widths (col-*) using AngularJS? I am trying to use ng-class as shown below, but it is not working. Any help will be greatly appreciated.

Here is the grid structure in my view:

<div class="row">
  <div ng-class="{{columnWidth}}"></div>
  <div ng-class="{{columnWidth}}"></div>
  <div ng-class="{{columnWidth}}"></div>
</div>

Here is the variable in my controller:

$scope.columnWidth = "col-md-3"; //Toggle between "col-md-3" and "col-md-4"

The columns just stack as if I'm on a mobile device regardless of what I set the scope variable too.

0

1 Answer 1

9

Should be like this,

  <div ng-class="columnWidth"></div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.