In my project, I've used a nesting of ng-repeat
to mount multiple checkbox
dynamically, allowing the user to merge filters , which works perfectly < in> controller loads the lists.
Now, the user asked to place these filters within a modal
, but apparently ng-repeat
does not work within the modal. Why does this happen?
I'm not asking for alternative solutions like using ui.bootstrap
and inject modal
of the angle itself. I really want to know why it does not work with modal natively.
Does% Bootstrap% eliminate tags containing javascript
or something like this? Am I using it the wrong way?
Here is an example of my ng-repeat
:
<!-- SEPARATED MODAL BODY - WORKS -->
<div ng-repeat="campo in camposFiltradosMotorista">
<div ng-repeat="tipo in tiposMotorista[campo]" class="checkbox checkbox-primary" class="styled">
<strong>
<input id="motorista{{tipo}}" type="checkbox" ng-model="tiposMotoristaSelecionados[campo][tipo]" />
<label for="motorista{{tipo}}">
{{tipo}} - ({{ (motoristasFiltrados | filter:count(campo, tipo)).length }})
</label>
</strong>
</div>
<hr ng-if="!$last" />
</div>
<div class="modal inmodal" id="filtro-modal-motoristas" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<i class="fa fa-laptop modal-icon"></i>
<h4 class="modal-title">Filtros de Motorista</h4>
<small class="font-bold"><i class="fa fa-lightbulb-o"></i> Você pode combinar vários filtros</small>
</div>
<div class="modal-body">
<span>Filtros</span>
<!-- INSIDE MODAL BODY - DOESN'T WORK :( -->
<div ng-repeat="campo in camposFiltradosMotorista">
<div ng-repeat="tipo in tiposMotorista[campo]" class="checkbox checkbox-primary" class="styled">
<strong>
<input id="motorista{{tipo}}" type="checkbox" ng-model="tiposMotoristaSelecionados[campo][tipo]" />
<label for="motorista{{tipo}}">
{{tipo}} - ({{ (motoristasFiltrados | filter:count(campo, tipo)).length }})
</label>
</strong>
</div>
<hr ng-if="!$last" />
</div>
</div>
</div>
</div>
</div>