I have a jQuery UI dialog, and in this pop up I have a dynamic <select>
with angular and Ajax request. My dialog shows up if I click on a button, but AngularJS script is played even if dialog isn't visible.
I stopped my script with a condition : if($("#MyDialog).dialog("isOpen") ===true)"
And it works, but I don't know how to "reload" my Angular Controller to load select input when my dialog is displayed...
I tried this : MyController(angular.element($('div[ng-controller="MyController"]')).scope(), angular.element($('div[ng-controller="MyController"]')).http);
but it doesn't works... Any idea ?
Code of my controller :
function MyController($scope, $http) {
if ($("#myDialog").dialog("isOpen") === true) {
$http.
success(function (data, status, headers, config) {
$scope.select = data;
}).
error(function (data, status, headers, config) {
alert("error !");
});
}
}
$("#myDialog")
, This code should probably live inside a directive. please provide a plunker