我遇到了AngularJS的问题。我在JSON文件中获取了数据。我还得到了负责从该文件中检索数据的服务。获取数据后,我想将它传递给我的指令,但我总是未定义(当我传递常量值时,如字符串 - 不是来自文件 - 它的工作原理)。我的代码:
HTML:
Public LastRow As Long
Sub RunThis()
LastRow = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
'Suite1
'Suite2
'Suite3
'Suite4
'Suite5
Suite6
'Suite7
'Suite8
'Suite9
'Suite10
'Suite11
End Sub
'==============================FIND===Suite6==================
Private Sub Suite6()
Dim ArrayOfStrings() As String
'ArrayOfStrings = Array("*S6R*", "*Suite6/*", "*Suite 6/*", "*Suite_6/*", "*Suite-6/*", _
"*Suite6.*", "*Suite 6.*", "*Suite_6.*", "*Suite-6.*", "*Suite-6/*")
ReDim ArrayOfStrings(9)
ArrayOfStrings(0) = "*S6R*"
ArrayOfStrings(1) = "*Suite6/*"
ArrayOfStrings(2) = "*Suite_6/*"
ArrayOfStrings(3) = "*Suite-6/*"
ArrayOfStrings(4) = "*Suite6.*"
ArrayOfStrings(5) = "*Suite 6.*"
ArrayOfStrings(6) = "*Suite_6.*"
ArrayOfStrings(7) = "*Suite-6.*"
ArrayOfStrings(8) = "*Suite 6/*"
ArrayOfStrings(9) = "*Suite-6/*"
ColumnToCheck = "A" 'you were looking for values in the A column, weren't you?
For i = 1 To LastRow 'in each of the rows
For j = LBound(ArrayOfStrings) To UBound(ArrayOfStrings) 'for each of the strings it could match
If Cells(i, ColumnToCheck).Value2 Like ArrayOfStrings(j) Then Cells(i, ColumnToCheck).Value2 = "Suite-6" 'if there's a match, then replace it with a uniform "Suite-6"
Next j
Next i
End Sub
控制器:
<experience-timeline ng-model="experience"/>
指令:
myAppCvExperienceModule.controller('ExperienceCtrl', function ($scope, dataService) {
dataService.getExpJson().success(function (res) {
$scope.experience = res;
});
});
为什么我总是未定义?如何正确传递数据?