我尝试在VF页面中嵌入一个角度js脚本。但我收到两个错误:
/ * ajpage:16 Uncaught SyntaxError:意外的令牌。 angular.min.js:40未捕获错误:[$ injector:modulerr] http://errors.angularjs.org/1.5.8/ $ injector / modulerr?p0 = app& p1 =错误%3A%20%... ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1 .5.8%2Fangular.min.js%3A20%3A390)
ajpage:
-1

任何人都可以帮我解决这个问题。
答案 0 :(得分:0)
尝试这种方式。
var app = angular.module(' app',[]); .controller(' myCtrl',function(){
//所有功能都在这里注入。
});
答案 1 :(得分:0)
<apex:page doctype="html-5.0" sidebar="false" showHeader="false">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
<div ng-app = "app" ng-controller="myCtrl">
<p>Please upload you file:</p>
<p><input type="file" ng-model="allText"/></p>
<button ng-click="readCSV()">Upload</button>
<button ng-click="extractfile()">test</button>
</div>
<div ng-repeat="f in constr">
{{constr}}
</div>
<script>
var app = angular.module('app',[]);
.controller('myCtrl', function(){
$scope.readCSV = function($scope) {
var allTextLines = $scope.allText.split(/\r\n|\n/);
for ( var i = 0; i < allTextLines.length; i++)
{
var tarr = [];
tarr.push(allTextLines[i]);
}
};
$scope.extractfile = function(tarr) {
var constr[];
var deployobj ={
"Componenttype": Componenttype,
"ComponentApiname":ComponentApiname,
};
deployobj.push(tarr);
for (var j=0;j<deployobj.length;j++)
{
var str1 = "<members>";
var str2 = "</members>";
if ($scope.deployobj[j].Componenttype=== customobject)
{
var result = str1 +" "+deployobj[j].Componenttype+" "+str3;
$scope.constr.push(result);
}
}
};
});
</script>
</apex:page>
更改了代码