angular.module('jett.ionic.content.banner', ['ionic']); /* global angular */ (function (angular) { 'use strict'; angular.module('jett.ionic.content.banner') .directive('ionContentBanner', [ '$interval', function ($interval) { return { restrict: 'E', scope: true, link: function ($scope, $element) { var stopInterval; $scope.currentIndex = 0; if ($scope.text.length > 1) { stopInterval = $interval(function () { $scope.currentIndex = ($scope.currentIndex < $scope.text.length - 1) ? $scope.currentIndex + 1 : 0; }, $scope.interval); } $scope.$on('$destroy', function() { $element.remove(); if (stopInterval) { $interval.cancel(stopInterval); } }); }, template: '
' + '' }; }]); })(angular); /* global angular,ionic */ /** * @ngdoc service * @name $ionicContentBanner * @module ionic * @description The Content Banner is an animated banner that will show specific information to a user. */ (function (angular, ionic) { 'use strict'; angular.module('jett.ionic.content.banner') .factory('$ionicContentBanner', [ '$document', '$rootScope', '$compile', '$timeout', '$ionicPlatform', function ($document, $rootScope, $compile, $timeout, $ionicPlatform) { /** * @ngdoc method * @name $ionicContentBanner#show * @description * Load and show a new content banner. */ function contentBanner (opts) { var scope = $rootScope.$new(true); angular.extend(scope, { icon: 'ion-ios-close-empty', transition: 'vertical', interval: 7000, type: 'info', $deregisterBackButton: angular.noop, closeOnStateChange: true }, opts); // Compile the template var classes = 'content-banner ' + scope.type + ' content-banner-transition-' + scope.transition; var element = scope.element = $compile('