Created
January 21, 2016 03:13
-
-
Save sasasa671/0f5d816774cb3583f7e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller('ApptsController', function($scope, $http, $state, $rootScope) { | |
$scope.postData = function (time, date) { | |
// don't use console.log, but debugger, it's much handier | |
console.log(" Appointment Times Listed"); | |
$http({ | |
method: 'GET', | |
url: 'https://api.parse.com/1/classes/appointments', | |
params: { | |
time: time, | |
date: date | |
}, | |
headers: { | |
'X-Parse-Application-Id': 'B5o3R92gcRqOLh4fYE6r5Uz4Z0pvwzxt5iLIKBUn', | |
'X-Parse-REST-API-Key': '9Yu15zG7jKQ3X2eEK26kz2CsLJYvtrO8Mwnm6BbP', | |
} | |
}) | |
.success(function (response, params, status, data, headers, config) { | |
console.log(); | |
$scope.appts = response.results; // response is an object conataining the reuslt array | |
// w | |
}) | |
.error(function (params, status) { | |
console.log(time + " eror"); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view title="Appointments" right-buttons="rightButtons"> | |
<ion-content has-header="true" has-tabs="true" padding="true" data-ng-init="postData()"> | |
<ion-refresher pulling-text="Pull to refresh" on-refresh="doRefresh()"> | |
</ion-refresher> | |
<div class="list"> | |
<div class="item item-divider"> | |
Upcoming Appointments | |
</div> | |
<a class="item" href="#" ng-repeat="item in appts"> | |
Time: {{ item.time }} - Stylist: {{ item.stylist }} | |
</a> | |
</div> | |
</ion-content> | |
</ion-view> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$scope.doRefresh = function (time, date) {
// don't use console.log, but debugger, it's much handier
console.log(" Appointment Times Listed");
$http({
method: 'GET',
url: 'https://api.parse.com/1/classes/appointments',
params: {
time: time,
date: date
},
headers: {
'X-Parse-Application-Id': 'B5o3R92gcRqOLh4fYE6r5Uz4Z0pvwzxt5iLIKBUn',
'X-Parse-REST-API-Key': '9Yu15zG7jKQ3X2eEK26kz2CsLJYvtrO8Mwnm6BbP',
}
})
.success(function (response, params, status, data, headers, config) {
console.log();
$scope.appts = response.results; // response is an object conataining the reuslt array
// w
$scope.$broadcast('scroll.refreshComplete')
})
.error(function (params, status) {
console.log(time + " eror");
});
};