Skip to content

Commit 5a5e898

Browse files
committed
Issue #36. [Ionic 1.2] - Create a module that demonstrates the Native scrolling feature
1 parent 60dd976 commit 5a5e898

6 files changed

+91
-0
lines changed

app/scripts/app.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ angular.module('starter', [
1717
'supermodular.menu',
1818
'supermodular.elements',
1919
'supermodular.popover-menu',
20+
'supermodular.native-scrolling',
2021
'gMaps',
2122
'ngCordova'
2223
])

app/scripts/menu/menu.html

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ <h1 class="title">Left</h1>
3434
<i class="icon ion-android-checkbox-outline"></i>
3535
Elements
3636
</ion-item>
37+
<ion-item nav-clear menu-close class="item-icon-left" href="#/app/native-scrolling">
38+
<i class="icon ion-ios-list-outline"></i>
39+
Native scrolling
40+
</ion-item>
3741
<ion-item nav-clear menu-close class="item-icon-left" href="#/app/map">
3842
<i class="icon ion-map"></i>
3943
Map
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
(function() {
2+
'use strict';
3+
4+
angular
5+
.module('supermodular.native-scrolling')
6+
.controller('NativeScrollingController', NativeScrollingController);
7+
8+
NativeScrollingController.$inject = ['nativeScrollingService'];
9+
10+
/* @ngInject */
11+
function NativeScrollingController(nativeScrollingService) {
12+
var vm = angular.extend(this, {
13+
items: []
14+
});
15+
16+
(function activate() {
17+
getItems();
18+
})();
19+
20+
// ********************************************************************
21+
22+
function getItems() {
23+
nativeScrollingService.getItems(200)
24+
.then(function(items) {
25+
vm.items = items;
26+
});
27+
}
28+
}
29+
})();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ion-view view-title="Native scrolling">
2+
<ion-content>
3+
<ion-list ng-repeat="item in vm.items">
4+
<ion-item>
5+
{{item}}
6+
</ion-item>
7+
</ion-list>
8+
</ion-content>
9+
</ion-view>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(function() {
2+
'use strict';
3+
4+
angular
5+
.module('supermodular.native-scrolling', [
6+
'ionic',
7+
'supermodular.common'
8+
])
9+
.config(function($stateProvider) {
10+
$stateProvider
11+
.state('app.native-scrolling', {
12+
url: '/native-scrolling',
13+
views: {
14+
'menuContent': {
15+
templateUrl: 'scripts/native-scrolling/native-scrolling.html',
16+
controller: 'NativeScrollingController as vm'
17+
}
18+
}
19+
});
20+
});
21+
})();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
(function() {
2+
'use strict';
3+
4+
angular
5+
.module('supermodular.native-scrolling')
6+
.factory('nativeScrollingService', nativeScrollingService);
7+
8+
nativeScrollingService.$inject = ['$q'];
9+
10+
/* @ngInject */
11+
function nativeScrollingService($q) {
12+
var service = {
13+
getItems: getItems
14+
};
15+
return service;
16+
17+
// *************************************************************************
18+
19+
function getItems(numberOfItems) {
20+
var items = [];
21+
for (var i = 0;i < numberOfItems;i++) {
22+
items.push('Item #' + (i + 1));
23+
}
24+
return $q.when(items);
25+
}
26+
}
27+
})();

0 commit comments

Comments
 (0)