Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用KendoUI事件重置角度形式_Javascript_Jquery_Angularjs_Forms_Kendo Ui - Fatal编程技术网

Javascript 使用KendoUI事件重置角度形式

Javascript 使用KendoUI事件重置角度形式,javascript,jquery,angularjs,forms,kendo-ui,Javascript,Jquery,Angularjs,Forms,Kendo Ui,我是AngularJS的新手,需要一些帮助,以便在事件发生时刷新AngularJS。我正在使用Kendo UI窗口模式打开表单,当表单关闭时,我想重置表单($setPristine和空表单数据),以便再次打开时它将是一个新表单 窗口有一个关闭事件,因此想到的一个解决方案是在窗口关闭时调用控制器函数。但当事件被触发时,我很难实现这一点 下面是用表单打开模式窗口的方法,有一个动态按钮调用它 //open the modal with form function openModal(id){

我是AngularJS的新手,需要一些帮助,以便在事件发生时刷新AngularJS。我正在使用Kendo UI窗口模式打开表单,当表单关闭时,我想重置表单($setPristine和空表单数据),以便再次打开时它将是一个新表单

窗口有一个关闭事件,因此想到的一个解决方案是在窗口关闭时调用控制器函数。但当事件被触发时,我很难实现这一点

下面是用表单打开模式窗口的方法,有一个动态按钮调用它

//open the modal with form 
function openModal(id){
    curItemId = id;
    console.log(curItemId);
    $("#window").kendoWindow({
        width: "800px",
        height: "510px",
        close: closedFunction, //can call a function from controller here?
        title: "",
        actions: [
            "Minimize",
            "Maximize",
            "Close"
        ]
    });

    var modalWindow = $("#window").data("kendoWindow");
    modalWindow.title("Contact Form");
    modalWindow.open();
    modalWindow.center();
}

<!-- this button is dynamically build and calls the above method -->    
<button id='"+e.Id+"' class='btn btn-default' onClick='openModal("+e.Id+")'>Contact</button>
我尝试在控制器内移动
openModal()
方法,并使用动态按钮中的
ng click
调用它,但没有成功,因为
ng click
不起作用。希望我把这个问题说清楚,如果我能提供更多细节,请告诉我

谢谢大家!

var app = angular.module("contactApp",[]);
app.controller('ContactController', function($scope,$sce){
     console.log('controller initiated');

        //variables 
        $scope.formData = {}; //formData is an object holding the name, email, subject, and message

        //submit function
        $scope.submit = function(contactform,event) {
            if (contactform.$valid) {
                //submit data

            } else {
                //something is wrong, try again.
            }
        }

        //reset function
        $scope.clearForm = function(contactform,event){
            //reset the form
        }

});