Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.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 对于页面刷新,$route.reload()或$window.location.reload()在angularjs中不起作用?_Javascript_Sql Server_Angularjs_Asp.net Mvc 4 - Fatal编程技术网

Javascript 对于页面刷新,$route.reload()或$window.location.reload()在angularjs中不起作用?

Javascript 对于页面刷新,$route.reload()或$window.location.reload()在angularjs中不起作用?,javascript,sql-server,angularjs,asp.net-mvc-4,Javascript,Sql Server,Angularjs,Asp.net Mvc 4,在添加新记录后,我正在尝试刷新/重新加载我的页面,但在我的情况下它不起作用。 这是我的控制器,它在新记录表单的保存按钮后调用 leads.save = function (isFormValid) { leads.submitted = true; if (isFormValid && !leads.exist) { leadsService.addEditLeads(le

在添加新记录后,我正在尝试刷新/重新加载我的页面,但在我的情况下它不起作用。 这是我的控制器,它在新记录表单的保存按钮后调用

leads.save = function (isFormValid) {
                leads.submitted = true;

                if (isFormValid && !leads.exist) {

                    leadsService.addEditLeads(leads, function () {
                        leads.submitted = false;

                        $modalInstance.dismiss('cancel');
                        $route.reload();
                    });
                    //$window.location.reload();
                }
            };
这是我的服务

_addEditLeads = function (leads, callback) {

        var Leads = {
            id: leads.id,
            title: leads.title,
            is_converted: leads.is_converted,
            street_address: leads.street_address,
            email: leads.email,
            lead_name: leads.lead_name,
            first_name: leads.first_name,
            middle_name: leads.middle_name,
            last_name: leads.last_name,
            phone_num: leads.phone_num,
            postal_code: leads.postal_code,
            city: leads.city,
            state: leads.state,
            country: leads.country,
            lead_owner_id: global.User.id,
            lead_source_id: leads.lead_source_id,
            lead_status_id: leads.lead_status_id,
            employees: leads.employees,
            industry_id: leads.industry_id,
            lead_date: new Date(),
            account_id:leads.account_id,
        };
        var Accounts = {
            account_name: leads.account_name,
            address: leads.address,
            phone: leads.phone,
            website: leads.website,
            description: leads.description,
            employees: leads.employees,
            city: leads.city,
            state: leads.state,
            country: leads.country,
            account_owner_id: global.User.id,
            industry_id: leads.industry_id

        };
        resource.user.addEditLead({ Lead: Leads, Accounts: Accounts })
            .$promise.then(function (response) {
                if (response.success) {
                    if (Leads.id != 0) {
                        //Update record
                        for (var i = 0; i < _leadsObject.data.length; i++) {
                            if (_leadsObject.data[i].id == Leads.id) {
                                _leadsObject.data[i] = Leads;
                                break;
                            }
                        }
                        notifyService.notifySuccess(Leads.title + " updated successfully");
                    }
                    else {
                        //Add new
                        notifyService.notifySuccess(Leads.title + " added successfully");
                        Leads.id = response.data;
                        if (_leadsObject.data != null)
                            _leadsObject.data.unshift(Leads);
                        else {
                            _leadsObject.data = [];
                            _leadsObject.data.push(Leads);
                        }
                        //callback(response.data);

                    }
                    if (typeof (callback) == 'function') {
                        callback();
                    }
                }

            }, _errorCallback);

    };
\u addEditLeads=函数(leads,回调){
var导线={
id:leads.id,
标题:leads.title,
是否已转换:leads.is_已转换,
街道地址:leads.street\u地址,
电子邮件:leads.email,
lead\u name:leads.lead\u name,
名字:leads.first_name,
中间名:leads.middle\u name,
姓氏:leads.姓氏,
电话号码:leads.phone号码,
邮政编码:leads.邮政编码,
城市:领导城市,
国家:领导国家,
国家:领先,
lead_owner_id:global.User.id,
lead\u source\u id:leads.lead\u source\u id,
lead\u status\u id:leads.lead\u status\u id,
员工:leads.employees,
行业id:leads.industry\u id,
潜在客户日期:新日期(),
客户id:leads.account\u id,
};
风险值账户={
客户名称:leads.account\u name,
地址:leads.address,
电话:leads.phone,
网站:leads.website,
description:leads.description,
员工:leads.employees,
城市:领导城市,
国家:领导国家,
国家:领先,
帐户\所有者\ id:global.User.id,
行业id:leads.industry\u id
};
resource.user.addEditLead({Lead:Leads,Accounts:Accounts})
.$PROMITE.then(功能(响应){
if(response.success){
如果(Leads.id!=0){
//更新记录
对于(变量i=0;i<\u leadsObject.data.length;i++){
if(_leadsObject.data[i].id==Leads.id){
_leadsObject.data[i]=Leads;
打破
}
}
notifyService.notifySuccess(Leads.title+“已成功更新”);
}
否则{
//新增
notifyService.notifySuccess(Leads.title+“添加成功”);
Leads.id=response.data;
如果(_leadsObject.data!=null)
_leadsObject.data.unshift(Leads);
否则{
_leadsObject.data=[];
_leadsObject.data.push(Leads);
}
//回调(response.data);
}
if(typeof(callback)=‘function’){
回调();
}
}
}),;
};
控制器通过MVC在数据库中添加数据,我使用的是sql server 2012数据库


请帮帮我?

您确定您正在使用
ngRoute
。。如果它的
ui.router
那么它将是
$state.reload()
我在like--leadatendantmodule.controller('LeadsController',['NotificationService','$scope','LeadsService','modal','ModalService','$route',函数(notifyService,$scope,leadservice,$modal,ModalService,$route)-----您能否确认
leadsService中的weather Controller
callback
。控制器上的addEditLeads(leads,callback)
正在被调用。您可以使用Chrome开发工具的调试(使用断点)功能来检查