Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clickable area of ui-select inside is 10px a bootstrap modal

I have a bootstrap modal and, inside it, I have a ui-select for tagging. Here's my example:

<div class="modal modal-invite">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <ui-select multiple tagging tagging-label="" ng-model="email_list" theme="bootstrap" ng-disabled="disabled" on-select="" on-remove=""  title="Insert your friends email here." >
          <ui-select-match placeholder="Your friends email here...">{{$item}}</ui-select-match>
          <ui-select-choices repeat="email in email_list | filter:$select.search">
            {{email}}
          </ui-select-choices>
        </ui-select>
      </div>
      <div class="modal-footer">
        <button class="btn btn-success">Invite</button>
      </div>
    </div>
  </div>
</div>

My problem is: When I open the modal with $('modal-invite').modal('show'), the size of the placeholder (and the clickable area) is 10 pixel, like this:

10px sized placeholder

Google Chrome inspector

After clicking on it, it gets the correct width.
How can I make ui-select refresh it's size when the modal opens?

like image 295
ProGM Avatar asked Oct 31 '22 04:10

ProGM


1 Answers

Finally I solved checking the ui-select sources.
It seems that ui-select recalculates the input size with a $watch on the parent width.

So, in order to refresh it, I did like this:

$('.modal-invite').modal('show');
$scope.$apply();
like image 88
ProGM Avatar answered Nov 11 '22 03:11

ProGM