我正在尝试在Google文档插件(Google App Script)项目中运行Angular cli生成的默认应用程序,就像在google app脚本中一样,仅允许.gs和.html文件,我已将所有angular的生成JS文件移至脚本标记并将其添加为html。但是当我运行附加组件时,出现此错误
userCodeAppPanel:6862 Uncaught Error: Can't resolve all parameters for ApplicationModule: (?).
at syntaxError (userCodeAppPanel:6862)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getDependenciesMetadata (userCodeAppPanel:22346)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getTypeMetadata (userCodeAppPanel:22241)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata (userCodeAppPanel:22109)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleSummary (userCodeAppPanel:21920)
at userCodeAppPanel:22033
at Array.forEach (<anonymous>)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata (userCodeAppPanel:22021)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleSummary (userCodeAppPanel:21920)
at userCodeAppPanel:22006
google app脚本项目中的目录结构
我为应用程序脚本修改的index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>AngularAddOn</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<?!= include('runtime.js');?>
<?!= include('vendor.js');?>
<?!= include('styles.js');?>
<?!= include('main.js');?>
<?!= include('polyfills.js');?>
<?!= include('es2015-polyfills.js');?>
<app-root></app-root>
</body>
</html>
这是我的code.gs文件
function myFunction() {
}
function onOpen(e) {
DocumentApp.getUi().createAddonMenu()
.addItem('Manage Citations', 'showSidebar')
// .addItem("test dialog", 'showDialog')
.addToUi();
}
function showSidebar() {
var html = HtmlService.createTemplateFromFile('index').evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME).setTitle('wizdom.ai');
DocumentApp.getUi().showSidebar(html);
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename).getContent();
}
在Google加载项中无法运行angular吗?还是我想念什么?
我已经尝试过将以下内容添加到polyfills.ts中,但没有运气
import 'core-js/es7/reflect';
谢谢
答案 0 :(得分:0)
根据另一个问题,How to use AngularJS within Google Apps Script有人建议
“将angular.js包含脚本语句移动到头部”
我看到你的在正文部分。将它们换到头部就可以了。