0

I'm using angularjs and I want to dynamically define a button-bar. Something like this:

<div class="bar bar-subheader" ng-show="tournament.gameTableCreated">
    <div class="button-bar">
        <div ng-repeat="category in categories | orderBy : 'name' track by $id(category)"
                  type="item-text-wrap">
            <button class="button button-positive" ng-click="showAndHide(category.name)">{{category.name}}</button>
        </div>  
    </div>
</div>

The button bar works fine, but button-bar class is not applied and buttons are not resized according to the screen width.

Plunker added: http://plnkr.co/edit/axML5fG9ht4boLF2tsoV

Any idea how to deal with it?

Thanks in advance

4
  • Your js code would help. Commented Aug 24, 2015 at 22:32
  • Please add the html output of this template code and css information. Commented Aug 24, 2015 at 22:32
  • there isn't anything obvious here which would cause that css class to not show; definitely angular isn't at play with a <div class="button-bar"> only. Commented Aug 24, 2015 at 22:47
  • plunker added. Thanks Commented Aug 24, 2015 at 22:50

1 Answer 1

1

the ionic button-bar CSS class only applies it's styling to it's direct descendants; In your code, the ng-repeat div actually wraps your buttons, causing them to not be the direct descendants.

In this case, the <div> is unnecessary, and the <button> can be the element that is repeated.

<div class="button-bar">
    <button ng-repeat="category in categories | orderBy : 'name' track by $id(category)"
            type="item-text-wrap"
            class="button button-positive" 
            ng-click="showAndHide('HEL', showHelp)">{{category.name}}
    </button>
</div>

http://plnkr.co/edit/410vEsA5s4RMIZwEK0Vh?p=preview

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.