我有一个用 Office Javascript API (Office.js) 编写的 Office 任务窗格应用程序,它调用 Office.context.document.getFilePropertiesAsync 并将返回的 URL 放在一个角度变量中:
$scope.getDocumentUrl = function () {
Office.context.document.getFilePropertiesAsync(function (asyncResult) {
$scope.url = asyncResult.value.url;
});
};
然后我有一个调用它的按钮。这是第一次工作的文件,但是当我第二次按下按钮时,它永远不会进入回调并显示此错误:
TypeError:在匿名函数(https://localhost:44304/scripts/office/1.1/o15apptofilemappingtable.js :11:83048 ) 在匿名函数 ( https://localhost:44304/scripts/office/1.1/o15apptofilemappingtable.js:11:86071 ) 在 $scope.getDocumentUrl ( https://localhost:44304/AngularJs/controllers/sandpit .controller.js:130:6 ) 在 $parseFunctionCall ( https://localhost:44304/AngularJs/bower_components/angular/angular.js:12403:7 ) 在回调 ( https://localhost:44304/AngularJs/bower_components/角/角.js:21566:17) 在 Scope.prototype.$eval ( https://localhost:44304/AngularJs/bower_components/angular/angular.js:14466:9 ) 在 Scope.prototype.$apply ( https://localhost:44304/AngularJs/bower_components /angular/angular.js:14565:11 ) 在匿名函数 ( https://localhost:44304/AngularJs/bower_components/angular/angular.js:21571:17 ) 在 jQuery.event.dispatch ( https://localhos
这是产生相同错误的另一种情况的简化版本。getFileAsync 也会发生这种情况。我知道我需要 $scope.$apply 来显示更改。我知道您可以通过其他方式获取 URL。我需要知道错误的原因。