AngularJS:ng-repeat不起作用

时间:2016-01-23 09:01:05

标签: javascript angularjs

对于我的角度代码,ng重复不起作用。

这是部分:

Private Sub InformCustomer_Click()

On Error GoTo Err_InformCustomer_Click

    Dim CustName As String      ' Customer Name
    Dim varTo As Variant        '-- Address for SendObject
    Dim stText As String        '-- E-mail text
    Dim DelDate As Variant      '-- Rec date for e-mail text
    Dim stSubject As String     '-- Subject line of e-mail
    Dim stOrderID As String     '-- The Order ID from form
    Dim detailQry As String
    'Dim stHelpDesk As String    '-- Person who assigned ticket
    'Dim strSQL As String        '-- Create SQL update statement
    'Dim errLoop As Error

    CstName = Me![CustName]
    varTo = Me![CustEmail]
    stSubject = ":: Update - Oder Status ::"
    stOrderID = Me.[OdrID]
    DelDate = Me.[OdrDeliveryDate]
    stText = "Dear" & CstName & _
             "You have been assigned a new ticket." & Chr$(13) & Chr$(13) & _
             "Order Number: " & stOrderID & Chr$(13) & _
             "Please refer to your order status " & Chr$(13) & _
             "Exp Delevery Date: " & DelDate & Chr$(13) & Chr$(13) & _
              dQuery & Chr$(13) & _
             "This is an automated message. Please do not respond to this e-mail."

    'Write the e-mail content for sending to assignee
    DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, True
  Err_InformCustomer_Click:
    MsgBox Err.Description
End Sub

这是控制器:

 <section class="artistpage">
      <ul class="artistlist">
        <li ng-model = "questions" ng-repeat="item in questions">
          <input type="checkbox" name = "q">{{item.ct}}
          </input>
          </li>
         </ul>
    </section>

数据:

var testControllers = angular.module('testControllers', []);

testControllers.controller('ListController', ['$scope', '$http', function($scope, $http) {
  $http.get('js/cat.json').success(function(data) {
    $scope.questions = data;
  });
}]);

我无法弄清楚为什么这不起作用。求救!

3 个答案:

答案 0 :(得分:2)

这里的问题是您没有访问对象信息,您应该访问每个元素信息并获取值

像这样改变你的ng-repeat,

<div contenteditable></div>

工作Plunker

答案 1 :(得分:0)

{{1}}

ng-model应该不一样。所以使用ng-model =&#34;问题&#34;而不是问题

Here is plunker

答案 2 :(得分:0)

您只需将{{item.ct}}替换为{{item.info.ct}},因为您的外部对象中有对象info。查看FIDDLE

<section class="artistpage">
      <ul class="artistlist">
        <li ng-model = "questions" ng-repeat="item in questions">
          <input type="checkbox" name = "q"/>{{item.info.ct}}
          </li>
         </ul>
</section>