I'm using this modal window using angular and bootstrap ui
<script type="text/ng-template" id="myModalContent.html">
<div class="modal-header">
<h3 class="modal-title">Cambia Palmare {{descPalmare}} ( {{descProgetto}} )</h3>
</div>
<div class="modal-body">
<ul>
<li >
<select id="soluzioneDlg" name="soluzioneDlg"
class="required"
ng-options="soluzione.id as soluzione.denominazione for soluzione in soluzioni"
ng-model="soluzioneCorrente"
ng-change="filtroSoluzione()"></select>
</li>
<select id="progettoDlg" name="progettoDlg"
class="required"
ng-options="progetto.id as progetto.denominazione for progetto in progetti"
ng-model="progettoCorrente"></select>
<li>
</li>
</ul>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
I'm opening the dialog correctly and the soluzioneDlg select is filled correctly.
When the selection is changed, the filtroSoluzione method is correctly called but the scope variable bound using ng-model is undefined.
$scope.filtroSoluzione = () => {
alert($scope.soluzioneCorrente);
var progettoPromise = progetti.progettiSoluzione($scope.soluzioneCorrente);
progettoPromise.then(function (progetti: Factories.Progetto[]) {
$scope.progetti = progetti;
},
function (reason) {
alert('errore in recupero lista dispositivi: ' + reason);
}, function (update) {
alert('Got notification: ' + update);
});
}
Am I missing something? I used this code in other pages and is working correctly.
Thanks,
Luca
this is the angular code that calls the $modal.open
// cambia assegnazione, apro la finestra di assegnazione
$scope.cambiaAssegnazione = (palmare: number) => {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: assegnaDispIspettoreDialog,
size: '(large)',
resolve: {
palmareDaAggiornare: function () {
return palmare;
},
dispositivi: function () {
return dispositivi;
},
soluzioni: function () {
return soluzioni;
},
progetti: function () {
return progetti;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selectedItem = selectedItem;
}, function () {
alert('Modal dismissed at: ' + new Date());
});
}
when I click a link in a list the mg_chnage change this code that open the dialog: in the resolve I send the reference of a few services I created, because I have to fill the listbox in the modal dialog.
the descPalmare, descProgetto and soluzioni scope properties are handled correctly: the only problem is in the soluzioneCorrente member
I created the full repro here:
http://plnkr.co/edit/G8qygJWkYCqiYZK5FcgN