Skip to content

Instantly share code, notes, and snippets.

View panda4man's full-sized avatar

Andrew Clinton panda4man

View GitHub Profile

Keybase proof

I hereby claim:

  • I am panda4man on github.
  • I am aclinton (https://keybase.io/aclinton) on keybase.
  • I have a public key ASAwCm4h9miSif3k8dmaeT-XJ_VJvis5puE610FDKigjZgo

To claim this, I am signing this object:

@panda4man
panda4man / app.js
Created January 18, 2015 01:28
Ionic Route Example
$stateProvider
.state('app', {
url: "/app",
abstract: true,
controller: 'MainCtrl',
templateUrl: "templates/tabs.html",
resolve: {
Migrations: ['$q', 'InitService', function($q, Init) {
return Init.promise.then(function(good) {
return good;
angular.module('qAllSettled', []).config(function($provide) {
$provide.decorator('$q', function($delegate) {
var $q = $delegate;
$q.allSettled = function(promises) {
return $q.all(promises.map(function(promise) {
return promise.then(function(value) {
return { state: 'fulfilled', value: value };
}, function(reason) {
return { state: 'rejected', reason: reason };
});
//Filesystem (checkDir, createDir, checkFile, creatFile, removeFile, writeFile, readeFile)
.factory('FileService', function($q) {
return {
checkDir: function (dir) {
var deferred = $q.defer();
getFilesystem().then(
function(filesystem) {
filesystem.root.getDirectory(dir, {create: false},