TypeError: Cannot read property 'concat' undefined

Mon problème est que quand je lance mon projet, il me donne une erreur qui dit: TypeError: Cannot read property 'concat' undefined. il ne s'affiche pas s'il vous plaît aider.

app.js

    var Call24 = angular.module("Call24", ["ngResource", "ngRoute"]).
config(function($routeProvider) {
$routeProvider.
when('/', { controller: ListCtrl, templateUrl: 'CycleModal.html' }).
when('/edit/:editId', { controller: EditCtrl, templateUrl: 'details.html' }).
otherwise({ redirectTo: '/' });
Call24.factory('cyclesFactory', function ($resource) {
return $resource('/api/Cycles/:id', { id3: '@id3' }, { update: 'PUT' });
});
var ListCtrl = function ($scope, $location, data,$http) {
$scope.selectTest = null;
$scope.testTest = [];
$scope.cycle = [];
$http({
method: 'GET',
url: '/api/Cycles/',
data: { CycleID: 1 }
}).success(function (result) {
$scope.testTest = result;
});
$scope.search = function() {
data.query({
offset: $scope.offset,
limit: $scope.limit
},
function(something) {
$scope.cycle = $scope.cycle.concat(something);
});
};
$scope.search();
$scope.show_more = function() {
$scope.offset += $scope.limit;
$scope.search();
};
$scope.reset = function () {
$scope.limit = 4;
$scope.offset = 0;
$scope.cycle = [];
$scope.search();
}
};

html

Semaines dans le Cycle

                    <div class="col-sm-3">
<div class="form-group">
<div class="input-group input-group-addon">
<label>Cycle number</label>
<input ng-model="query" class="form-control" placeholder="search         rep">
<!--<div class="input-group-btn">
<button ng-click="reset()" class="btn btn-default"    type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>-->
</div>
</div>
</div>
<div class="col-sm-1">
<div class="form-group">
<div class="input-group input-group-addon">
<!--<label>Rep</label>
<input ng-model="part" class="form-control" placeholder="search rep">-->
<div class="input-group-btn">
<button ng-click="reset()" class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<table class="table table-striped table-condensed table-bordered">
<thead>
<th>Cycle Id</th>
<th>Weeks In Cycle</th>
<th>Cycle Number</th>
<th>Start Date</th>
<th>End Date</th>
</thead>
<tbody>
<tr ng-repeat="liss in cycle">
<td>{{liss.CycleID}}</td>
<td>{{liss.WeeksInCycle}}</td>
<td>{{liss.Cycle}}</td>
<td>{{liss.StartDate}}</td>
<td>{{liss.EndDate}}</td>
</tr>
</tbody>
</table>
<div class="form-actions">
<button class="btn btn-primary" ng-click="updateSurvey()">
Ok
</button>
<button class="btn btn-danger">
<a href="#/index.html" style="color: white; text-decoration: none">Cancel</a>
</button>
</div>

Je veux afficher la liste à partir d'une table, mais il continue de donner l'erreur que j'ai indiqué ci-dessus.

  • Essayez d'ajouter $champ d'application.cycle = [] en haut
  • oui, il n'a d'afficher les lignes et les colonnes, mais les données n'est pas affiché
InformationsquelleAutor ninjaXnado | 2015-01-12