3

I am trying to run Angular cli generated default app, in Google doc add-on (Google App Script) project, As in google app script only .gs and .html files are allowed i have moved all angular's build JS files in script tags and added them as html. But when i run the add-on i am getting this error

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

Directory structure in google app script project

enter image description here

my modified index.html for app-script

<!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>

And here is my code.gs file

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

Is it impossible to run angular in google add-on? or am i missing something?

i already tried adding following to polyfills.ts but no luck

import 'core-js/es7/reflect';

Thanks

1

1 Answer 1

1

According to this other question, How to use AngularJS within Google Apps Script someone suggested to

"move the angular.js include script statement into the head section"

I see yours are in the body section. Change them to the head and it should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.