Skip to content

Instantly share code, notes, and snippets.

@FernandoBasso FernandoBasso/app.js
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.