This file contains 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
const fetchConfig = () => { | |
const $initInjector = angular.injector(['ng']); | |
const $http = $initInjector.get('$http'); | |
const $window = $initInjector.get('$window'); | |
return $http.get(`${$window.__APPTICLES_BOOTSTRAP_DATA__.CONFIG_PATH}`); | |
}; | |
... | |
fetchConfig() |
This file contains 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
{ | |
"export": { | |
"categories": { | |
"find": "//pwathemes.com/demo-api/wp-json/wp/v2/categories", | |
"findOne": "//pwathemes.com/demo-api/wp-json/wp/v2/categories" | |
}, | |
"posts": { | |
"find": "//pwathemes.com/demo-api/wp-json/wp/v2/posts", | |
"findOne": "//pwathemes.com/demo-api/wp-json/wp/v2/posts" | |
} |
This file contains 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
'use strict'; | |
angular.module('appticles.api').factory('AppticlesAPI', AppticlesAPI); | |
AppticlesAPI.$inject = ['$log', '$http', 'configuration']; | |
/** | |
* @ngdoc service | |
* @name appticles.api.AppticlesAPI | |
* |
This file contains 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
class Categories { | |
constructor($log, AppticlesAPI) { | |
const populateCategories = (result) => { | |
this.categories = result; | |
}; | |
AppticlesAPI.findCategories({hide_empty: 1}) | |
.then(populateCategories) | |
.catch($log.error); |
This file contains 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 view-title="Progressive Web App Sample" cache-view="false"> | |
<ion-content> | |
<ion-list> | |
<div | |
ng-repeat="category in categoriesVm.categories"> | |
<p data-ng-bind-html="category.name | TrustHtmlFilter"></p> | |
</div> | |
</ion-list> | |
</ion-content> | |
</ion-view> |
This file contains 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
angular.module('appticles.validation') | |
.factory('AppticlesValidation', AppticlesValidation); | |
/** | |
* @ngdoc service | |
* @name appticles.validation.AppticlesValidation | |
* | |
* @description Service for validating data coming from the API. | |
*/ |
This file contains 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
class Categories { | |
constructor($log, $q, AppticlesAPI, AppticlesValidation) { | |
const validateCategories = (result) => { | |
let validatedCategories = AppticlesValidation.validateCategories(result); | |
return $q.when(validatedCategories); | |
}; | |
const populateCategories = (result) => { | |
if (angular.isUndefined(result.error)) { |
This file contains 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
angular.module('appticles.categories', [ | |
'ui.router', | |
'appticles.api', | |
'appticles.configuration' | |
]) | |
.config(['$stateProvider', '$urlRouterProvider', ($stateProvider, $urlRouterProvider) => { | |
$stateProvider | |
.state('categories', { | |
url: '/categories', | |
controller: 'CategoriesController as categoriesVm', |
This file contains 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
<!DOCTYPE HTML> | |
<html manifest="" <?php language_attributes(); ?>> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-touch-fullscreen" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | |
<meta name="mobile-web-app-capable" content="yes" /> |
This file contains 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
<?php | |
use Automattic\WooCommerce\Client; | |
class Custom_Endpoints_Woocommerce_API | |
{ | |
protected function get_client() { | |
return new Client( | |
get_site_url(), | |
'woocommerce_consumer_key', | |
'woocommerce_consumer_secret', |
OlderNewer