AngularJS,工厂VisualForce远程处理错误
AngularJS, factory VisualForce Remoting error
所以我试图创建一些东西,从SalesForce中动态提取数据,并将其显示在我的angular应用程序中。我创建了下面的.factory函数:
app.factory('getDocuments', ['$q','$rootScope', function($q, $rootScope){
return function (inputString) {
var deferred = $q.defer();
Visualforce.remoting.Manager.invokeAction(
'FO_Manager.getDocuments',
inputString,
function(result, event){
$rootScope.$apply(function(){
if(event.status) {
deferred.resolve(result);
} else {
deferred.reject(event);
}
})
},
{buffer: true, escape: true, timeout: 30000}
);
return deferred.promise;
}}]);
当页面加载getDocuments('a0N17000001NxjO').then(function(result){$scope.documents = result;},
function(error){$scope.error = result;});
时,如果我在控制器中运行它,它会运行得很好
当我试图在我的指令中动态运行时,问题就出现了
app.directive('foSidenav',['getDocuments', function(getDocuments){
function linker($scope, element, attrs){
$scope.selectDocType = function(id)
{
alert('docId updated');
alert(id);
getDocuments(id).then(function(result){$scope.DocType = result;},
function(error){$scope.error = result;});
};
}
return{
restrict: 'E',
replace: true,
scope: {
info:'=',
DocType:'='
},
templateUrl:function(element,attr){
return attr.url;
},
link:linker
};}]);
现在的问题是,当我运行这个代码时,警报显示良好,但后来我得到了这个错误:
主线程上的同步XMLHttpRequest已被弃用,因为它会对最终用户的体验产生有害影响。有关更多帮助,请查看http://xhr.spec.whatwg.org/.
知道怎么绕过这个吗??
原来错误在其他地方,这个特定的错误并没有阻止脚本正确运行。
我的一些语法不正确!
相关文章:
- 是否存在Javascript Liferay Service库的文档?如何处理错误情况
- RxJS:在循环中处理错误.js自定义驱动程序
- 通过 AJAX 检索 Blob 时处理错误消息
- Chai正如承诺:当承诺抛出错误时,处理错误
- 如何处理错误'控制台未定义'在powershell中
- Bloodhound的新Typeahead是如何处理错误的
- 请求管道处理错误
- Angular Jasmine SpyOn$resource处理错误
- 如何或如何使用firebase有效地处理错误
- 以处理错误的方式启动javascript承诺蓝鸟链
- JavaScript Regex over CSS:如何处理错误的类
- 模态中的 Django 形式:动态重定向和处理错误
- 在 Angular 中使用拦截器处理错误的通用方法
- Angular JSON-RPC:处理错误
- AngularJS - 处理错误错误:[ng:areq] 在此特殊情况下 (?)
- 绕过 javascript 的 chrome 和 FF 后台选项卡处理错误
- 如何使用 Q 和 JS 捕获或失败来处理错误
- 使用 window.onerror 和 try-catch 块处理错误之间的差异
- jQuery $.get 在处理错误时返回白色错误页
- 处理错误后提交索引数据库事务