diff --git a/demos/swipeable-cards/script.js b/demos/swipeable-cards/script.js index 21761409ed..1a0c5bb466 100644 --- a/demos/swipeable-cards/script.js +++ b/demos/swipeable-cards/script.js @@ -1,77 +1,63 @@ -angular.module('ionicApp', ['ionic', 'ionic.contrib.ui.cards']) +// Ionic Starter App -.config(function ($stateProvider, $urlRouterProvider) { +// 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 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 +// Ionic Starter App - $stateProvider +// 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 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', 'ionic.contrib.ui.cards']) - .state('tab', { - url: "/", - templateUrl: "templates/home.html" - }); - - - $urlRouterProvider.otherwise('/'); - -}) - -.directive('noScroll', function ($document) { +.directive('noScroll', function($document) { return { restrict: 'A', - link: function ($scope, $element, $attr) { + link: function($scope, $element, $attr) { - $document.on('touchmove', function (e) { + $document.on('touchmove', function(e) { e.preventDefault(); }); } - }; + } }) -.controller('CardsCtrl', function ($scope, $ionicSwipeCardDelegate) { +.controller('CardsCtrl', function($scope, $ionicSwipeCardDelegate) { var cardTypes = [ - { - title: 'Swipe down to clear the card', - image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic.png' - }, - { - title: 'Where is this?', - image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic.png' - }, - { - title: 'What kind of grass is this?', - image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic2.png' - }, - { - title: 'What beach is this?', - image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic3.png' - }, - { - title: 'What kind of clouds are these?', - image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic4.png' - } + { title: 'Swipe down to clear the card', image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic.png' }, + { title: 'Where is this?', image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic.png' }, + { title: 'What kind of grass is this?', image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic2.png' }, + { title: 'What beach is this?', image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic3.png' }, + { title: 'What kind of clouds are these?', image: 'http://ionicframework.com.s3.amazonaws.com/demos/ionic-contrib-swipecards/pic4.png' } ]; $scope.cards = Array.prototype.slice.call(cardTypes, 0, 0); - $scope.cardSwiped = function (index) { + $scope.cardSwiped = function(index) { $scope.addCard(); }; - $scope.cardDestroyed = function (index) { + $scope.cardDestroyed = function(index) { $scope.cards.splice(index, 1); }; - $scope.addCard = function () { + $scope.addCard = function() { var newCard = cardTypes[Math.floor(Math.random() * cardTypes.length)]; newCard.id = Math.random(); $scope.cards.push(angular.extend({}, newCard)); - }; + } }) -.controller('CardCtrl', function ($scope, $ionicSwipeCardDelegate) { - $scope.goAway = function () { +.controller('CardCtrl', function($scope, $ionicSwipeCardDelegate) { + $scope.goAway = function() { var card = $ionicSwipeCardDelegate.getSwipebleCard($scope); card.swipe(); }; -}); \ No newline at end of file +}); +