Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
839 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
wp-api-angularjs | ||
================ | ||
|
||
AngularJS services to consume [WP-API v2](http://v2.wp-api.org/) | ||
|
||
## Documentation | ||
|
||
<http://shprink.github.io/wp-api-angularjs/> | ||
|
||
## Authentication | ||
|
||
This library only supports basic auth. OAuth1 not being suitable for JS clients (it would mean exposing key and password out of the open) | ||
|
||
### Basic auth | ||
|
||
Basic auth is only secured to use if used during the app run time and used with a secured connection to your Blog (via SSL). | ||
|
||
#### During run time | ||
|
||
Make sure your WP-API runs with an SSL certificate (https) otherwise this will expose your credentials at every request. | ||
|
||
Display a form for users to connect and use the following code to register credentials: | ||
|
||
``` | ||
.controller(function(WpApi){ | ||
WpApi.setBasicCredentials(<login>, <password>); | ||
}); | ||
``` | ||
|
||
#### During configuration | ||
|
||
You can also set basic credentials during the configuration but use this should only be used for testing as it embed credentials in the application code. | ||
|
||
``` | ||
.config(function(WpApiProvider){ | ||
WpApiProvider.setBasicCredentials(<login>, <password>); | ||
}); | ||
``` | ||
|
||
## Contribute | ||
|
||
``` | ||
npm install | ||
cp config.dist.json config.json | ||
# Open two terminals | ||
# and run watch to build on the lib files changes | ||
npm run watch | ||
# in the other terminal run following to build the test page and the doc | ||
npm run devserver | ||
``` | ||
|
||
Open ```http://localhost:8080``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Provider from './provider.js'; | ||
import Run from './run.js'; | ||
|
||
let mod = angular.module('ionic-native-transitions', [ | ||
'ionic', | ||
// 'ui-router' | ||
]); | ||
|
||
mod.provider('$ionicNativeTransitions', Provider); | ||
mod.run(Run); | ||
|
||
export default mod = mod.name; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* @ngdoc service | ||
* @name ionic-native-transitions.$ionicNativeTransitions | ||
* @description | ||
* ionic-native-transitions service | ||
*/ | ||
/** | ||
* @ngdoc service | ||
* @name ionic-native-transitions.$ionicNativeTransitionsProvider | ||
* @description | ||
* ionic-native-transitions provider | ||
*/ | ||
export default function($httpProvider) { | ||
'ngInject'; | ||
|
||
let options = { | ||
"direction": "up", // 'left|right|up|down', default 'left' (which is like 'next') | ||
"duration": 500, // in milliseconds (ms), default 400 | ||
"slowdownfactor": 3, // overlap views (higher number is more) or no overlap (1), default 4 | ||
"iosdelay": 100, // ms to wait for the iOS webview to update before animation kicks in, default 60 | ||
"androiddelay": 150, // same as above but for Android, default 70 | ||
"winphonedelay": 250, // same as above but for Windows Phone, default 200, | ||
"fixedPixelsTop": 0, // the number of pixels of your fixed header, default 0 (iOS and Android) | ||
"fixedPixelsBottom": 60 // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android) | ||
}; | ||
|
||
return { | ||
$get, | ||
setOptions | ||
}; | ||
|
||
/** | ||
* @ngdoc function | ||
* @name ionic-native-transitions.$ionicNativeTransitionsProvider#setBasicCredentials | ||
* @access public | ||
* @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider | ||
* | ||
* @description | ||
* Overwrite default nativepagetransitions plugin options | ||
* @param {object} injectedOptions options that will overwrite defaults | ||
*/ | ||
|
||
/** | ||
* @ngdoc function | ||
* @name ionic-native-transitions.$ionicNativeTransitions#setBasicCredentials | ||
* @access public | ||
* @methodOf ionic-native-transitions.$ionicNativeTransitions | ||
* | ||
* @description | ||
* Overwrite default nativepagetransitions plugin options | ||
* @param {object} injectedOptions options that will overwrite defaults | ||
*/ | ||
function setOptions(injectedOptions = {}) { | ||
angular.merge(options, injectedOptions); | ||
console.log(options); | ||
return this; | ||
} | ||
|
||
function $get($log) { | ||
'ngInject'; | ||
|
||
return { | ||
init, | ||
setOptions | ||
}; | ||
|
||
/** | ||
* @ngdoc function | ||
* @name ionic-native-transitions.$ionicNativeTransitions#init | ||
* @access public | ||
* @methodOf ionic-native-transitions.$ionicNativeTransitions | ||
* | ||
* @description | ||
* Init nativepagetransitions plugin | ||
*/ | ||
function init() { | ||
|
||
if (window.cordova && window.plugins && window.plugins.nativepagetransitions) { | ||
angular.merge(window.plugins.nativepagetransitions.globalOptions, options); | ||
} else { | ||
$log.info('nativepagetransitions plugin does not exist, cannot initialize.'); | ||
} | ||
} | ||
} | ||
}; |
Oops, something went wrong.