为什么我不能关闭我的剑道窗口

时间:2016-02-03 11:16:37

标签: javascript angularjs kendo-ui

我的页面上有这个剑道窗口:

<kendo-button ng-click="modalEnquiryText.center().open();" value="Open" class="k-button">
    Enquiry Text
</kendo-button>

<div kendo-window="modalEnquiryText" k-width="1000" k-height="380" k-visible="false" k-title="'Enquiry Text Viewer'">

    <div class="col-md-12">

        <div class="k-content">
            <ul kendo-panel-bar k-options="panelBarOptions">
                <li class="k-state-active">
                    Current Sticky Notes
                    <div class="row">
                        <div class="col-md-12">
                            <textarea id="EnquiryTextEditor" kendo-editor k-ng-model="FormattedEnquiryText"></textarea>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <br />
    <div class="pull-right">
        <kendo-button ng-click="modalenquirytext.center().close(); bindHtml()" value="Close" class="k-button k-primary">
            Add Enquiry Text
        </kendo-button>

        <kendo-button  ng-click="closeModal(); modalEnquiryText.center().close()" value="Cancel" class="k-button">
            Discard and Close Window
        </kendo-button>
    </div>
</div>

我尝试过使用带有两个功能的ng-click并且不起作用,我尝试使用jQuery选择窗口div并使用以下代码关闭它:

$scope.bindHtml = function() {
                        $scope.enquiryText = strip($scope.FormattedEnquiryText);
                        //reset values on close
                        $("#EnquiryTextEditor").data("kendoEditor").value("");
                        commmonUtilities.addAlert('Enquiry Text Added', 'success');

                       $("#modalEnquiryText").data("kendoWindow").close();

                        //$("#modalEnquiryText").data("kendoWindow").close();
                    };

.close();是一个未定义的函数。

有谁知道我需要改变什么?我正在使用angularJs和kendo ui。

1 个答案:

答案 0 :(得分:2)

在Angular(kendo-window="modalEnquiryText")中为Kendo小部件添加名称使得小部件对象可以通过作用域/控制器访问 - 因此在您的情况下,您可以在ng-click函数中使用$scope.modalEnquiryText.close()。沿着这些方向的东西可能会起作用:

$scope.bindHtml = function() {
  $scope.enquiryText = strip($scope.FormattedEnquiryText);
  $scope.FormattedEnquiryText = ""; // Don't use jQuery here either! Angular bindings are two-way.
  commmonUtilities.addAlert('Enquiry Text Added', 'success');
  $scope.modalEnquiryText.close();
};