Attached
<script src="js/angular/angular.js"></script>
<script src="js/lib/iscroll.js"></script>
<script src="js/lib/ng-iscroll.js"></script>
JS File
var App = angular.module('MyApp', [ 'ng-iscroll', ]);
App.controller('LoadUsers', ['$scope', function ($scope) {
$.ajax({
url: JSON URL HERE,
type: 'GET',
dataType: 'json',
headers: {
'Accept-Encoding': 'gzip'
},
crossDomain: true,
timeout: 15000,
success: function (data) {
var nData = [];
angular.forEach(data, function (value, key) {
/* ############################ Scope ############################ */
var nItem = {};
nItem.fleetUser = value.name;
nData.push(nItem);
});
$scope.fleet = nData;
$scope.$apply();
},
error: function (data) {
$scope.error = true;
$scope.$apply();
}
});
}]);
HTML
<div ng-controller="LoadUsers">
<div id="wrapper" ng-iscroll>
<ons-list>
<ons-list-item ng-show="error">Server Connection Error</ons-list-item>
<ons-list-item class="topcoat-list__item__line-height" ng-repeat="item in fleet">{{item.fleetUser}}
<br/>
</ons-list-item>
</ons-list>
</div>
</div>
I am experiencing difficulties while trying to integrate the latest iScroll version into my project. The list on my mobile device is not displaying and I keep encountering this error message:
Uncaught TypeError: Cannot read property 'length' of undefined iscroll.js:1303
IScroll.goToPage iscroll.js:1303
IScroll._wheel iscroll.js:1084
IScroll.handleEvent
Is this the correct approach for implementing iScroll within an Angular repeat? The list functions properly without it.
Thank you