簡體   English   中英

SharePoint Online Webpart頁面上的AngularJS錯誤

[英]AngularJS Error on SharePoint Online Webpart Page

我有一個Web部件頁面,在其中添加了腳本編輯器Web部件。 然后,我將以下代碼粘貼到...

    <link data-require="bootstrap-css@*" data-semver="3.0.0" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
<h2>Questionnaire:</h2>
<br />
<div ng-app="App">
    <div ng-controller="spListCtrl">
        <table width="100%" cellpadding="10" cellspacing="2" class="employee-table">
            <tr ng-repeat="control in Controls">
                <td>{{control.Title}}</td>
                <td>
                    <input type="radio" name="{{control.Id}}" value="Yes">Yes
                    <input type="radio" name="{{control.Id}}" value="No">No
                </td>
                <td>
                    <textarea id="{{control.Id}}Comment"></textarea>
                </td>
            </tr>
        </table>
    </div>
</div>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script>
    jQuery(document).ready(function () {
        var App = angular.module('App', [])
        .controller('spListCtrl', function ($scope, $http) {
            $http({
                method: 'GET',
                url: "https://myteamsite.domain.com/_api/web/lists/getByTitle('MyListName')/items?$select=Id,Title",
                headers: { "ACCEPT": "application/json;odata=verbose" }
            }).success(function (data, status, headers, config) {
                $scope.Controls = data.d.results;
            });
        });
    });
</script>

保存並查看頁面時,我只會看到“ {{control.Title}}”

當我在Chrome中檢查控制台時,看到一條錯誤消息,提示無法加載該模塊...

未捕獲的錯誤:[$ injector:modulerr]

我已經檢查並重新檢查了拼寫。 什么都沒用。 我想念什么?

您需要刪除jQuery(document).ready(function () {將運行您的代碼,為什么它首先需要您在這里。

工作朋克

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM