Search code examples
angular-componentsangular-kendo

Reference Kendo Window from Angular 1.5 component


I have an Angular 1.5 (with components) application. I am using Kendo UI as a front end framework.

I have a window defined as:

<div kendo-window="wSearch" k-title="'Search Results'" k-visible="false" k-actions="['Close']" k-width="'600px;'" k-height="'500px'">
	<h2>Search Results</h2>
</div>

The problem I am having is opening the window from the component. If I want to open the window from a button directly I could do that:

ng-click="wSearch.center().open()"

The issue is that I need to perform some logic before opening the window so I need to open it from code, not the markup.

How can I reference wSearch from code?

Thank you.


Solution

  • For those of view, facing the same issue, here is how I resolved it:

    in the click method:

    $scope.wSearch.center().open();

    just make sure that $scope is injected in the component definition.

    I am not sure if this is the best way to do that. I know that the use of $scope is discouraged when using components, but I could not find any other way to achieve that.

    Hope that helps.