2015-04-28 47 views
2

我有一個Web部件頁面,其中添加了腳本編輯器Web部件。然後我粘貼下面的代碼在...SharePoint Online Webpart上的AngularJS錯誤頁面

<link data-require="[email protected]*" 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中,我看到一個錯誤說該模塊無法加載...

Uncaught Error: [$injector:modulerr]

我已檢查並重新檢查拼寫。沒有任何工作。我錯過了什麼?

回答

0

您需要移除jQuery(document).ready(function() {才能運行您的代碼,爲什麼它首先需要您。

Working Plunkr

+0

做upvote如果它確實幫助你.. :) –