2016-09-16 7 views
-2

私はHTMLファイル(と動作します)で角度を宣言しましたので、Angular、 のアプリケーションをGoogleスクリプトでコーディングしようとしていますが、私の.gsファイルは角度関数を理解しません。角度:Googleスクリプトの角度を含む

(うまく動作します)私のHTML

<html ng-app="gemStore"> 
<head> 
     <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script> 
     <script type="text/javascript" src="main.gs"></script> 
</head> 
<body> 
... 
</body> 
</html> 

と角ライブラリ私のjavaファイル内

(function() { 
var app = angular.module('gemStore', []); 

app.controller('StoreController', function(){ 
this.product = gems; 
}); 

var gems = 
{ name: 'Azurite', price: 2.95 } 
; 
})(); 

を認識していない私のjavaファイル、私はエラー "にReferenceError" を持っています"は定義されていません(行2)"

ありがとう

+0

'https'を使わずにjsを読み込もうとします。 – Vineet

+0

私はそれを直接ファイルにロードしようとしたので、私がブートストラップに入ったときにうまくいきました。しかし、私はそれをGoogleのシートにコピーしたが、うまくいきませんでした。私は自分のプロジェクトで.jsを直接インポートすることはできませんでした –

+0

1)java?そのJavaではありません。 2).gsは角度と無関係です。あなたは.jsを意味しましたか? googleスクリプトの –

答えて

0

あなたはもう少しchangをする必要があります

アンギュラ例ガス構造::それを動作させるために、ESは、私はここで例を作っ

index.htmlを

<!DOCTYPE html> 
    <?!= include('js'); ?> 

<html> 
    <head> 
    <base target="_top"> 
    <?!= include('css'); ?> 
    </head> 
    <body> 
    <div > 


<div ng-app="gemStore"> 
    <div ng-controller="StoreController"> 
    <h1>Write here</h1> 
     <input ng-model="name" ng-keyup="NameChange()"> 
     <h1>{{greeting}}</h1> 
     <h2>{{name}}</h2> 
    </div> 

    </div> 

    </div> 
    </body> 
</html> 

Core.gs

function doGet(e) { 
    var t = HtmlService.createTemplateFromFile('index'); 
    return t.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME).setTitle('Angular Example By Daniel C'); 
} 
function include(filename) { 
     return HtmlService.createHtmlOutputFromFile(filename) 
      .getContent(); 
    } 

js.html

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> 
<script> 

    angular.module('gemStore', []) 
     .controller('StoreController', function($scope) { 
      $scope.NameChange = function() { 
       $scope.greeting = "Hello " + $scope.name; 
      }; 
     }); 

</script> 

css.html

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> 
<style> 
/*your styles here*/ 
</style> 

それはあなたのコードを使用していないが、私はあなたが簡単にそれを適応させると確信しています。

ありがとうございます!

関連する問題