-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
65 lines (54 loc) · 1.85 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var app = angular.module('newsApp', ['ionic']);
app.controller('newsController', function($scope, $http) {
$scope.news = [];
$scope.loadMore = function() {
var parameters = {
id: $scope.lastarticleID
};
$http.get('http://codedamn.com/filesCodedamn/news.php', { params: parameters }).success(function(items) {
$scope.lastarticleID = items.lastID;
angular.forEach(items, function(item) {
$scope.news.push(item);
});
$scope.$broadcast('scroll.infiniteScrollComplete');
});
};
$scope.doRefresh = function() {
$scope.news = [];
$http({
method: "GET",
url: "http://codedamn.com/filesCodedamn/news.php"
}).then(function(newsData) {
angular.forEach(newsData.data, function(newsArticle) {
$scope.news.push(newsArticle);
});
$scope.lastarticleID = newsData.data.lastID;
$scope.$broadcast('scroll.refreshComplete');
});
};
$http({
method: "GET",
url: "http://codedamn.com/filesCodedamn/news.php"
}).then(function(newsData) {
angular.forEach(newsData.data, function(newsArticle) {
$scope.news.push(newsArticle);
});
$scope.lastarticleID = newsData.data.lastID;
});
});
app.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})