AngularJS,工厂 VisualForce Remoting 错误

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
};}]);

现在的问题是,当我 运行 此代码时,警报显示正常,但随后出现此错误:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

知道如何解决这个问题吗?

事实证明错误出在其他地方,这个特定错误并没有阻止脚本适当地 运行。

我的某些语法错误!