Skip to content

Instantly share code, notes, and snippets.

@FernandoBasso
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FernandoBasso/e40a6881f8ae29ff7937 to your computer and use it in GitHub Desktop.
Save FernandoBasso/e40a6881f8ae29ff7937 to your computer and use it in GitHub Desktop.
ionic open view upon clicking button
var l = function l() {
console.log.apply(console, arguments);
};
var itemsDb = null;
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
var myApp = angular.module('starter', ['ionic', 'ui.router', 'starter.controllers', 'ngCordova'])
.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
//if (!window.cordova) {
itemsDb = $cordovaSQLite.openDB({ name: 'acheiitems.db' }); //device
//}
//else {
// itemsDb = window.openDatabase('acheiitems.db', '1', 'my', 1024 * 1024 * 100); // browser
//}
l($cordovaSQLite);
});
})
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('tab', {
url: '/tab',
abstract: true,
templateUrl: 'templates/tabs.html'
})
.state('tab.home', {
url: '/home',
views: {
'tab-home': {
templateUrl: 'templates/tab-home.html',
controller: 'HomeCtrl'
}
}
})
.state('tab.items', {
url: '/items',
views: {
'tab-items': {
templateUrl: 'templates/tab-items.html',
controller: 'ItemsCtrl'
}
}
})
.state('tab.add-item', {
url: '/add-item',
views: {
'tab-items': {
templateUrl: 'templates/tab-add-item.html',
controller: 'AddItemCtrl'
}
}
})
$urlRouterProvider.otherwise("/tab/home");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment