Hi,
I am trying to convert existing code that uses ngModal (similar to bootstrap modal) to a kendo window control. This is within an Angular 1.4 SPA, 2016 Q1 Kendo Pro. The issue I'm having is that I can't figure out how to set the controller for the modal and be able to open it from a function in a different controller. I run into problems where either I can find and open the window but the controller is the calling controller, or I cannot find the window by id at all.
The original code in gridController looks something like this:
function openModal() {
$scope.myModal = ngDialog.open({
template: 'scripts/sections/contract/views/partials/myModal.html',
scope: $scope,
controller: 'modalController',
backdrop: 'static',
closeByDocument: false,
preCloseCallback: function (value) {
$("#myGrid").data("kendoGrid").dataSource.read();
}
});
The kendo window widget does not have controller or scope properties, so a simple replacement won't work. My next attempt was to wrap the myModal.html with the following, <div data-ng-controller="modalController as vm"> <div kendo-window="kwindow" k-options="windowOptions">. The modalController has $scope.windowOptions ={...} with appropriate values. When I do this: var kwin = $("#kwindow").data("kendoWindow"); from the gridController, kwindow is always empty. Alternatively, I can put the window in html that lives under the GridController and then find it, but that will never work for segregating the controllers and I want to keep them separated. So how can this be done?