<!DOCTYPE html>
<html>
<head>
<link data-require="ionic@*" data-semver="1.0.0-beta.1" rel="stylesheet" href="http://code.ionicframework.com/nightly/css/ionic.css" />
<script data-require="ionic@*" data-semver="1.0.0-beta.1" src="http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
<link rel="stylesheet" href="style.css" />
<!-- your app's js -->
<script src="app.js"></script>
<script src="controllers.js"></script>
<script src="services.js"></script>
<style>
.slider{
position: absolute;
top:0;
bottom:0;
left: 0;
right: 0;
}
.slider-pager{
bottom:50px;
}
</style>
</head>
<body ng-app="starter" animation="slide-left-right-ios7">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-chevron-left">
Back
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
</html>
// 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'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])
.run(function ($ionicPlatform) {
$ionicPlatform.ready(function () {
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
.config(function ($stateProvider, $urlRouterProvider) {
// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
$stateProvider
// setup an abstract state for the tabs directive
.state('tab', {
url: "/tab",
abstract: true,
templateUrl: "tabs.html"
})
// Each tab has its own nav history stack:
.state('tab.home', {
url: '/home',
views: {
'tab-home': {
templateUrl: 'tab-home.html',
controller: 'HomeCtrl'
}
}
})
.state('tab.tv', {
url: '/tv',
views: {
'tab-tv': {
templateUrl: 'tab-tv.html',
controller: 'TvCtrl'
}
}
})
.state('tab.data', {
url: '/data',
views: {
'tab-data': {
templateUrl: 'tab-data.html',
controller: 'DataCtrl'
}
}
})
.state('tab.achievements', {
url: '/achievements',
views: {
'tab-achievements': {
templateUrl: 'tab-achievements.html',
controller: 'AchievementCtrl'
}
}
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/home');
})
;
angular.module('starter.controllers', [])
.controller('HomeCtrl', function ($scope) {
$scope.tab = {
name: 'Home'
}
})
.controller('TvCtrl', function ($scope) {
$scope.tab = {
name: 'Toilet TV'
}
})
.controller('DataCtrl', function ($scope) {
$scope.tab = {
name: 'Data'
};
})
.controller('AchievementCtrl', function ($scope) {
$scope.tab = {
name: 'Achievements'
}
})
.controller('SlideboxCtrl', function ($scope, $location) {
$scope.screen = {
name: 'Slidebox'
};
});
<ion-view title="{{tab.name}}">
<ion-content has-header="true" padding="true">
</ion-content>
</ion-view>
<ion-view title="{{tab.name}}">
<ion-content class="has-header padding">
</ion-content>
</ion-view>
<ion-view title="{{tab.name}}">
<ion-slide-box show-pager="true">
<ion-slide>
<ion-content><h1>BLUE</h1></ion-content>
</ion-slide>
<ion-slide>
<ion-content><h1>BLUE</h1></ion-content>
</ion-slide>
<ion-slide>
<ion-content><h1>BLUE</h1></ion-content>
</ion-slide>
</ion-slide-box>
</ion-view>
<ion-view title="{{tab.name}}">
<ion-content class="has-header padding">
</ion-content>
</ion-view>
<!--
Create tabs with an icon and label, using the tabs-positive style.
Each tab's child <ion-nav-view> directive will have its own
navigation history that also transitions its views in and out.
-->
<ion-tabs class="tabs-icon-top">
<ion-tab title="Home" icon="icon ion-home" href="#/tab/home">
<ion-nav-view name="tab-home"></ion-nav-view>
</ion-tab>
<ion-tab title="TV" icon="icon ion-heart" href="#/tab/tv">
<ion-nav-view name="tab-tv"></ion-nav-view>
</ion-tab>
<ion-tab title="Data" icon="icon ion-gear-b" href="#/tab/data">
<ion-nav-view name="tab-data"></ion-nav-view>
</ion-tab>
<ion-tab title="Achievements" icon="icon ion-gear-b" href="#/tab/achievements">
<ion-nav-view name="tab-achievements"></ion-nav-view>
</ion-tab>
</ion-tabs>
angular.module('starter.services', [])
/**
* A simple example service that returns some data.
*/
.factory('Friends', function() {
// Might use a resource here that returns a JSON array
// Some fake testing data
var friends = [
{ id: 0, name: 'Scruff McGruff' },
{ id: 1, name: 'G.I. Joe' },
{ id: 2, name: 'Miss Frizzle' },
{ id: 3, name: 'Ash Ketchum' }
];
return {
all: function() {
return friends;
},
get: function(friendId) {
// Simple index lookup
return friends[friendId];
}
}
});