2014-10-08 31 views
0

你好,我有以下選項的網格:在指令訪問selectedItems從NG-GRD

$ scope.mySourceSelections = [];

$scope.gridOptions = { 
      data: 'formatSources', 
      showSelectionCheckbox: true, 
      enableCellSelection: true, 
      enableRowSelection: true, 
      multiSelect: false, 
      selectedItems: $scope.mySourceSelections 

    }; 

在我的指導我有一個模板嵌入我的網頁上的HTML。 在我div標籤我有屬性:
data-activity-source={{mySourceSelections}}

當頁面呈現的屬性產生: data-activity-source="[{"SourceName":"College of Letters & Science"}]"

設置源,我需要的語法是data-activity-source="College of Letters & Science"

當我改變我的模板是:data-activity-source={{mySourceSelections[0].SourceName}} 我收到以下兩個錯誤:

GET /api/v1/activity/public?s=0&l=1&o=College%20of%20Letters%20&%20Science 400 (Bad Request) jquery-1.11.1.min.js?v=1412791216854:4 
ERROR: getPublicActivitiesForSource : ajax : error 

我知道試圖訪問mySourceSelections的[0]索引時,這正在發生。我如何解決這個問題,並獲得「學院文字&科學」的SourceName值?

+0

您希望請求格式爲?你能舉一個你想要的API調用的例子嗎? – 2014-10-08 18:17:53

回答

0

它看起來像&符號導致您的GET問題。嘗試對請求進行urlen編碼。 「&」符號是%26因此請嘗試:

GET /api/v1/activity/public?s=0&l=1&o=College%20of%20Letters%20%26%20Science 
+0

謝謝約翰。這是&符號。 – imchingy 2014-10-08 18:35:26