Skip to content

Commit

Permalink
fixed DI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
arielfaur committed Aug 28, 2015
1 parent 783cb4f commit 21e62fe
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
20 changes: 10 additions & 10 deletions dist/ion-pullup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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,
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -137,15 +137,15 @@ angular.module('ionic-pullup', [])
}
};

window.addEventListener('orientationchange', function() {
$window.addEventListener('orientationchange', function() {
footer.status != FooterStatus.DEFAULT && collapse();
$timeout(function() {
computeHeights();
}, 500);
});

init();
},
}],
compile: function(element, attrs) {
attrs.defaultHeight && element.css('height', parseInt(attrs.defaultHeight, 10) + 'px');
element.addClass('bar bar-footer');
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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);
});
}
Expand Down
7 changes: 0 additions & 7 deletions example/www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
20 changes: 10 additions & 10 deletions example/www/js/ion-pullup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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,
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -137,15 +137,15 @@ angular.module('ionic-pullup', [])
}
};

window.addEventListener('orientationchange', function() {
$window.addEventListener('orientationchange', function() {
footer.status != FooterStatus.DEFAULT && collapse();
$timeout(function() {
computeHeights();
}, 500);
});

init();
},
}],
compile: function(element, attrs) {
attrs.defaultHeight && element.css('height', parseInt(attrs.defaultHeight, 10) + 'px');
element.addClass('bar bar-footer');
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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);
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 21e62fe

Please sign in to comment.