From 21e62fe8810a758c27e8ae0e90e8b3d47f5bd3cc Mon Sep 17 00:00:00 2001 From: Ariel Faur Date: Fri, 28 Aug 2015 15:43:50 -0300 Subject: [PATCH] fixed DI issues --- bower.json | 2 +- dist/ion-pullup.js | 20 ++++++++++---------- example/www/js/controllers.js | 7 ------- example/www/js/ion-pullup.js | 20 ++++++++++---------- package.json | 2 +- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/bower.json b/bower.json index 4d85f81..01bacf5 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "ionic-pullup", "description": "Ionic pull up footer", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/arielfaur", "license": "MIT", "private": false, diff --git a/dist/ion-pullup.js b/dist/ion-pullup.js index d6553f6..b64da13 100644 --- a/dist/ion-pullup.js +++ b/dist/ion-pullup.js @@ -4,7 +4,7 @@ angular.module('ionic-pullup', []) MINIMIZED: 0, EXPANDED: 1 }) - .directive('ionPullUpFooter', ['$timeout', '$rootScope', function($timeout, $rootScope) { + .directive('ionPullUpFooter', ['$timeout', '$rootScope', '$window', function($timeout, $rootScope, $window) { return { restrict: 'AE', scope: { @@ -15,7 +15,7 @@ angular.module('ionic-pullup', []) maxHeight: '=?', defaultHeight: '=?' }, - controller: function($scope, $element) { + controller: ['$scope', '$element', function($scope, $element) { var FooterStatus = { DEFAULT: -1, MINIMIZED: 0, @@ -46,7 +46,7 @@ angular.module('ionic-pullup', []) } function computeHeights() { - footer.height = $scope.maxHeight > 0 ? $scope.maxHeight : window.innerHeight - headerHeight - handleHeight - tabsHeight; + footer.height = $scope.maxHeight > 0 ? $scope.maxHeight : $window.innerHeight - headerHeight - handleHeight - tabsHeight; footer.lastPosY = (tabs && hasBottomTabs) ? footer.height - tabsHeight : footer.height - $scope.defaultHeight; $element.css({'height': footer.height + 'px', @@ -87,7 +87,7 @@ angular.module('ionic-pullup', []) }; this.getBackground = function() { - return window.getComputedStyle($element[0]).background; + return $window.getComputedStyle($element[0]).background; }; this.onTap = function(e) { @@ -137,7 +137,7 @@ angular.module('ionic-pullup', []) } }; - window.addEventListener('orientationchange', function() { + $window.addEventListener('orientationchange', function() { footer.status != FooterStatus.DEFAULT && collapse(); $timeout(function() { computeHeights(); @@ -145,7 +145,7 @@ angular.module('ionic-pullup', []) }); init(); - }, + }], compile: function(element, attrs) { attrs.defaultHeight && element.css('height', parseInt(attrs.defaultHeight, 10) + 'px'); element.addClass('bar bar-footer'); @@ -190,7 +190,7 @@ angular.module('ionic-pullup', []) } } }]) - .directive('ionPullUpHandle', ['$ionicGesture', '$timeout', function($ionicGesture, $timeout) { + .directive('ionPullUpHandle', ['$ionicGesture', '$timeout', '$window', function($ionicGesture, $timeout, $window) { return { restrict: 'AE', require: '^ionPullUpFooter', @@ -206,7 +206,7 @@ angular.module('ionic-pullup', []) background: background, position: 'absolute', top: 1-height + 'px', - left: ((window.innerWidth - width) / 2) + 'px', + left: (($window.innerWidth - width) / 2) + 'px', height: height + 'px', width: width + 'px', //margin: '0 auto', @@ -221,9 +221,9 @@ angular.module('ionic-pullup', []) element.find('i').toggleClass(toggleClasses); }); - window.addEventListener('orientationchange', function() { + $window.addEventListener('orientationchange', function() { $timeout(function() { - element.css('left', ((window.innerWidth - width) / 2) + 'px'); + element.css('left', (($window.innerWidth - width) / 2) + 'px'); }, 500); }); } diff --git a/example/www/js/controllers.js b/example/www/js/controllers.js index 356b595..9a41876 100644 --- a/example/www/js/controllers.js +++ b/example/www/js/controllers.js @@ -7,13 +7,6 @@ angular.module('starter.controllers', []) $scope.footerCollapse = function() { console.log('Footer collapsed'); }; - - $scope.tabExpand = function(index) { - console.log('Tab ' + index + ' expanded'); - }; - $scope.tabCollapse = function(index) { - console.log('Tab ' + index + ' collapsed'); - }; }) .controller('ChatsCtrl', function($scope, Chats) { diff --git a/example/www/js/ion-pullup.js b/example/www/js/ion-pullup.js index d6553f6..b64da13 100644 --- a/example/www/js/ion-pullup.js +++ b/example/www/js/ion-pullup.js @@ -4,7 +4,7 @@ angular.module('ionic-pullup', []) MINIMIZED: 0, EXPANDED: 1 }) - .directive('ionPullUpFooter', ['$timeout', '$rootScope', function($timeout, $rootScope) { + .directive('ionPullUpFooter', ['$timeout', '$rootScope', '$window', function($timeout, $rootScope, $window) { return { restrict: 'AE', scope: { @@ -15,7 +15,7 @@ angular.module('ionic-pullup', []) maxHeight: '=?', defaultHeight: '=?' }, - controller: function($scope, $element) { + controller: ['$scope', '$element', function($scope, $element) { var FooterStatus = { DEFAULT: -1, MINIMIZED: 0, @@ -46,7 +46,7 @@ angular.module('ionic-pullup', []) } function computeHeights() { - footer.height = $scope.maxHeight > 0 ? $scope.maxHeight : window.innerHeight - headerHeight - handleHeight - tabsHeight; + footer.height = $scope.maxHeight > 0 ? $scope.maxHeight : $window.innerHeight - headerHeight - handleHeight - tabsHeight; footer.lastPosY = (tabs && hasBottomTabs) ? footer.height - tabsHeight : footer.height - $scope.defaultHeight; $element.css({'height': footer.height + 'px', @@ -87,7 +87,7 @@ angular.module('ionic-pullup', []) }; this.getBackground = function() { - return window.getComputedStyle($element[0]).background; + return $window.getComputedStyle($element[0]).background; }; this.onTap = function(e) { @@ -137,7 +137,7 @@ angular.module('ionic-pullup', []) } }; - window.addEventListener('orientationchange', function() { + $window.addEventListener('orientationchange', function() { footer.status != FooterStatus.DEFAULT && collapse(); $timeout(function() { computeHeights(); @@ -145,7 +145,7 @@ angular.module('ionic-pullup', []) }); init(); - }, + }], compile: function(element, attrs) { attrs.defaultHeight && element.css('height', parseInt(attrs.defaultHeight, 10) + 'px'); element.addClass('bar bar-footer'); @@ -190,7 +190,7 @@ angular.module('ionic-pullup', []) } } }]) - .directive('ionPullUpHandle', ['$ionicGesture', '$timeout', function($ionicGesture, $timeout) { + .directive('ionPullUpHandle', ['$ionicGesture', '$timeout', '$window', function($ionicGesture, $timeout, $window) { return { restrict: 'AE', require: '^ionPullUpFooter', @@ -206,7 +206,7 @@ angular.module('ionic-pullup', []) background: background, position: 'absolute', top: 1-height + 'px', - left: ((window.innerWidth - width) / 2) + 'px', + left: (($window.innerWidth - width) / 2) + 'px', height: height + 'px', width: width + 'px', //margin: '0 auto', @@ -221,9 +221,9 @@ angular.module('ionic-pullup', []) element.find('i').toggleClass(toggleClasses); }); - window.addEventListener('orientationchange', function() { + $window.addEventListener('orientationchange', function() { $timeout(function() { - element.css('left', ((window.innerWidth - width) / 2) + 'px'); + element.css('left', (($window.innerWidth - width) / 2) + 'px'); }, 500); }); } diff --git a/package.json b/package.json index 9722e75..59a637e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ionic-pullup", "private": false, - "version": "1.0.0", + "version": "1.0.1", "description": "Ionic pull up footer", "repository": "https://github.com/arielfaur", "license": "MIT",