kjartanvalur / angular-kendo-window

Angular Kendo Window
MIT License
25 stars 9 forks source link

templateUrl get lost somewhere in the promise resolution process #27

Closed noherczeg closed 8 years ago

noherczeg commented 8 years ago
...

let windowOptions = {
    options:{
        modal: true,
        title: $scope.config.title,
        resizable: false,
        height: 400,
        width: 400,
        visible: false
    },
    templateUrl: MY_TEMPLATE_KEY,
    controller: controller,
    resolve: {
        decision: function () {
            return $scope.config;
        }
    }
};

let windowInstance = $kWindow.open(windowOptions);
let test = $templateCache.get('MY_TEMPLATE_KEY');
console.log(test); // <div>hello!</div>

windowInstance.result.then(function (result) {
    if (result) {
        $scope.result = 'confirmed!';
        $scope.callback({data: result});
        console.log(result);
    }
    else{
        $scope.result = 'canceled!';
        console.log('canceled!');
    }
});

When the modal open() gets called the templateUrl resolution gets messed up, and the windowTemplateUrl inside your code resolves to undefined. This can't be happenning since if I manually get the template from the $templateCache I get the contents, see commented out part in example.

I'm digging deeper and deeper inside the promise resolution, but it's pretty darn complicated. Any help? I'll continue the debugging.

noherczeg commented 8 years ago

On line 196 you already have the content. How come it's not used, but you still try to handle the windowTemplateUrl part?

noherczeg commented 8 years ago

It wasn't a bug. It was my fault because I didn;t load window.html with webpack.

This should be considered though: https://github.com/kjartanvalur/angular-kendo-window/issues/24