Skip to content

Instantly share code, notes, and snippets.

@davidmaogomezz
Created September 16, 2015 18:25
Show Gist options
  • Save davidmaogomezz/8487088296a95a15a725 to your computer and use it in GitHub Desktop.
Save davidmaogomezz/8487088296a95a15a725 to your computer and use it in GitHub Desktop.
Ionic Slide Box
<html ng-app="app">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Ionic Slide Box</title>
<link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
<script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
</head>
<body>
<ion-header-bar class="bar bar-header bar-calm">
<h2 class="title">Slide Box</h2>
</ion-header-bar>
<ion-content scroll="false">
<div ng-controller="SlideBoxController as vm">
<ion-slide-box show-pager="true" on-slide-changed="vm.onSlideChanged($index)">
<ion-slide ng-repeat="item in vm.items">
<div class="box">
<h2>{{item.title}}</h2>
<p>{{item.desc}}</p>
</div>
</ion-slide>
</ion-slide-box>
</div>
</ion-content>
</body>
</html>
angular.module('app', ['ionic'])
.controller('SlideBoxController', function() {
var vm = this;
vm.items = [
{title: 'Item 1', desc: 'This is item 1'},
{title: 'Item 2', desc: 'This is item 2'},
{title: 'Item 3', desc: 'This is item 3'}
];
vm.onSlideChanged = function(slideIndex) {
// Do something when slide changes
};
})
.slider {
height: 300px;
background-color: #eee;
}
.box {
padding: 1em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment