kjartanvalur / angular-kendo-window

Angular Kendo Window
MIT License
25 stars 9 forks source link

More dependencies in modalController? #33

Closed raman-kashyap closed 7 years ago

raman-kashyap commented 7 years ago

Playing with your example here - http://plnkr.co/edit/NILoTF5yVdneHRqQbzdm?p=preview

I tried to change the script.js code into something like below. I have more dependencies in the modalController. I believe everything works as expected but modalController does not get "params" variable injected into it. It is always "undefined". Am I missing something?

` var MyApp = angular.module('myapp', ["kendo.window", "kendo.directives"]);

MyApp.controller("modalController", ["$scope", function ($scope, params) {

$scope.confirm = function(){
    console.log(params);
};

$scope.cancel = function(){
    console.log(params);
};

}]);

MyApp.controller("mycontroller", ["$scope", "$kWindow", function ($scope, $kWindow) {

$scope.title = "My modal title";

$scope.content = "This is my message to the window!";

$scope.result = "";

$scope.openWindow = function(title, message){
    $kWindow.open({
            options:{
                modal: true,
                title: $scope.title,
                resizable: true,
                height: 150,
                width: 400,
                visible: false
            },
            templateUrl: "modal1.html",
            controller: "modalController",
            resolve: {
                params: function () {
                    return {title: title, message: message};
                }
            }
    });
};

}]); `

pateketu commented 7 years ago

you need to specify params as dependency in the modalController if your example you only seem to have $scope as dependency

MyApp.controller("modalController", ["$scope", "params", function ($scope, params) {

}
raman-kashyap commented 7 years ago

Thank you very much. I appreciate it.