<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script type="text/javascript">
var moduleServiceUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/lists/getbytitle('Pages')/Items?$select=ID,Title,FileRef,Modules";
var appVar = angular.module('listApp', []);
appVar.controller('controller1', function ($scope, $http) {
$http({
method: 'GET',
url: moduleServiceUrl,
headers: { "Accept": "application/json;odata=verbose" }
}).success(function (data, status, headers, config) {
$scope.items = data.d.results;
$scope.modules = data.d.results.reduce((modules, item) => {
if (item.Modules) {
if (Array.isArray(modules[item.Modules])) {
modules[item.Modules].push(item);
} else {
modules[item.Modules] = [item];
}
}
return modules;
}, Object.create(null));
});
})
</script>
</head>
<body>
<hr />
<div ng-app="listApp">
<div id="App1" ng-controller="controller1">
<div ng-repeat="(module, items) in modules">
<p><strong>{{module}}</strong></p>
<p ng-repeat="item in items" style="padding-left:10px;">
<a ng-href="{{item.FileRef}}">{{item.Title}}</a>
</p>
</div>
</div>
</div>
</body>
</html>
IE is showing this error: [$injector:modulerr]角 - 應用程序在Chrome中工作,但不是IE
IE也說,「$範圍是不確定的」,雖然它是函數的參數。
此問題令人困惑,因爲代碼在Chrome中正常工作。
這就是爲什麼我認爲客戶端的JavaScript框架是一個可怕的想法。瀏覽器地獄。 – duffymo