0

I placed a kendo-window in my html.

according to the docs, the window object should be available on the scope.

now, I want to bind a listener to the window's activate event from within a controller that is declared inside the window. i.e.:

markup:

<body ng-app="app">

    <div kendo-window='potatoWindow'>
        <div ng-controller='PotatoController'>
            here
        </div>
    </div>

js:

var app = angular.module("app", ["ngRoute", "kendo.directives"]);

app.controller("PotatoController", function($scope){
    $scope.potatoWindow.bind("activate",
        function () {
            console.log("potato");
        });
});

... but the window object (potatoWindow) is not found on the $scope during the controller.

Qs:

  1. why is the window object not available? am i missing something?
  2. if there is no way to access the window object - is there a way to get the same results by other means?
jajdoo
  • 516
  • 1
  • 9
  • 21

1 Answers1

2

I think your kendo-window markup needs to be part of the controller markup. Also, try using the k-on-activate binding and define your function in the controller like this:

MARKUP:

  <div ng-controller='PotatoController'>
             <div kendo-window='potatoWindow' k-on-activate='fry()'>
                 here
             </div>
   </div>

JS:

  var app = angular.module("app", ["ngRoute", "kendo.directives"]);    
    app.controller("PotatoController", function($scope){
         $scope.fry = function(e){
              console.log('fried!');
         };
    });
thispatchofsky
  • 854
  • 6
  • 15