diff --git a/js/angular/controller/navBarController.js b/js/angular/controller/navBarController.js index 5fe099bd18..50b052dc74 100644 --- a/js/angular/controller/navBarController.js +++ b/js/angular/controller/navBarController.js @@ -18,10 +18,10 @@ function($scope, $element, $attrs, $ionicViewService, $animate, $compile, $ionic var self = this; - this.leftButtonsElement = angular.element( + this.leftButtonsElement = jqLite( $element[0].querySelector('.buttons.left-buttons') ); - this.rightButtonsElement = angular.element( + this.rightButtonsElement = jqLite( $element[0].querySelector('.buttons.right-buttons') ); @@ -93,7 +93,7 @@ function($scope, $element, $attrs, $ionicViewService, $animate, $compile, $ionic currentTitles = $element[0].querySelectorAll('.title'); if (currentTitles.length) { oldTitleEl = $compile('

')($scope); - angular.element(currentTitles[0]).replaceWith(oldTitleEl); + jqLite(currentTitles[0]).replaceWith(oldTitleEl); } //Compile new title newTitleEl = $compile('

')($scope); @@ -101,18 +101,18 @@ function($scope, $element, $attrs, $ionicViewService, $animate, $compile, $ionic //Animate in on next frame ionic.requestAnimationFrame(function() { - oldTitleEl && $animate.leave(angular.element(oldTitleEl)); + oldTitleEl && $animate.leave(jqLite(oldTitleEl)); - var insert = oldTitleEl && angular.element(oldTitleEl) || null; + var insert = oldTitleEl && jqLite(oldTitleEl) || null; $animate.enter(newTitleEl, $element, insert, function() { self._headerBarView.align(); }); //Cleanup any old titles leftover (besides the one we already did replaceWith on) - angular.forEach(currentTitles, function(el) { + forEach(currentTitles, function(el) { if (el && el.parentNode) { //Use .remove() to cleanup things like .data() - angular.element(el).remove(); + jqLite(el).remove(); } }); diff --git a/js/angular/controller/scrollController.js b/js/angular/controller/scrollController.js index ed87735b7d..024cc4cca7 100644 --- a/js/angular/controller/scrollController.js +++ b/js/angular/controller/scrollController.js @@ -24,7 +24,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca this._scrollViewOptions = scrollViewOptions; //for testing var element = this.element = scrollViewOptions.el; - var $element = this.$element = angular.element(element); + var $element = this.$element = jqLite(element); var scrollView = this.scrollView = new ionic.views.Scroll(scrollViewOptions); //Attach self to element as a controller so other directives can require this controller diff --git a/js/angular/controller/sideMenuController.js b/js/angular/controller/sideMenuController.js index e2d6d5e191..c75bfe8010 100644 --- a/js/angular/controller/sideMenuController.js +++ b/js/angular/controller/sideMenuController.js @@ -6,7 +6,7 @@ IonicModule '$ionicPlatform', function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform) { var self = this; - angular.extend(this, ionic.controllers.SideMenuController.prototype); + extend(this, ionic.controllers.SideMenuController.prototype); this.$scope = $scope; diff --git a/js/angular/controller/tabsController.js b/js/angular/controller/tabsController.js index cf68e4ad79..f3a7a39155 100644 --- a/js/angular/controller/tabsController.js +++ b/js/angular/controller/tabsController.js @@ -68,7 +68,7 @@ function($scope, $ionicViewService, $element) { $ionicViewService.goToHistoryRoot(tab.$historyId); } } else { - angular.forEach(self.tabs, function(tab) { + forEach(self.tabs, function(tab) { self.deselect(tab); }); diff --git a/js/angular/directive/collectionRepeat.js b/js/angular/directive/collectionRepeat.js index 7561efb532..70d57354cd 100644 --- a/js/angular/directive/collectionRepeat.js +++ b/js/angular/directive/collectionRepeat.js @@ -168,14 +168,14 @@ function($collectionRepeatManager, $collectionDataSource, $parse) { var heightGetter = function(scope, locals) { var result = heightParsed(scope, locals); - if (angular.isString(result) && result.indexOf('%') > -1) { + if (isString(result) && result.indexOf('%') > -1) { return Math.floor(parseInt(result, 10) / 100 * scrollView.__clientHeight); } return result; }; var widthGetter = function(scope, locals) { var result = widthParsed(scope, locals); - if (angular.isString(result) && result.indexOf('%') > -1) { + if (isString(result) && result.indexOf('%') > -1) { return Math.floor(parseInt(result, 10) / 100 * scrollView.__clientWidth); } return result; diff --git a/js/angular/directive/content.js b/js/angular/directive/content.js index ecb68f79f5..e85f4e7d5d 100644 --- a/js/angular/directive/content.js +++ b/js/angular/directive/content.js @@ -49,7 +49,7 @@ function($timeout, $controller, $ionicBind) { if (attr.scroll != 'false') { //We cannot use normal transclude here because it breaks element.data() //inheritance on compile - innerElement = angular.element('
'); + innerElement = jqLite('
'); innerElement.append(element.contents()); element.append(innerElement); } diff --git a/js/angular/directive/item.js b/js/angular/directive/item.js index 1d8fa4093e..dd2bccfd72 100644 --- a/js/angular/directive/item.js +++ b/js/angular/directive/item.js @@ -43,7 +43,7 @@ function($animate, $compile) { /ion-(delete|option|reorder)-button/i.test($element.html()); if (isComplexItem) { - var innerElement = angular.element(isAnchor ? ITEM_TPL_CONTENT_ANCHOR : ITEM_TPL_CONTENT); + var innerElement = jqLite(isAnchor ? ITEM_TPL_CONTENT_ANCHOR : ITEM_TPL_CONTENT); innerElement.append($element.contents()); $element.append(innerElement); diff --git a/js/angular/directive/itemDeleteButton.js b/js/angular/directive/itemDeleteButton.js index f01df55cb6..e5c78580d7 100644 --- a/js/angular/directive/itemDeleteButton.js +++ b/js/angular/directive/itemDeleteButton.js @@ -44,7 +44,7 @@ IonicModule return function($scope, $element, $attr, ctrls) { var itemCtrl = ctrls[0]; var listCtrl = ctrls[1]; - var container = angular.element(ITEM_TPL_DELETE_BUTTON); + var container = jqLite(ITEM_TPL_DELETE_BUTTON); container.append($element); itemCtrl.$element.append(container).addClass('item-left-editable'); diff --git a/js/angular/directive/itemOptionButton.js b/js/angular/directive/itemOptionButton.js index 9a33396230..2a80731ac1 100644 --- a/js/angular/directive/itemOptionButton.js +++ b/js/angular/directive/itemOptionButton.js @@ -37,7 +37,7 @@ return { $attr.$set('class', ($attr['class'] || '') + ' button', true); return function($scope, $element, $attr, itemCtrl) { if (!itemCtrl.optionsContainer) { - itemCtrl.optionsContainer = angular.element(ITEM_TPL_OPTION_BUTTONS); + itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS); itemCtrl.$element.append(itemCtrl.optionsContainer); } itemCtrl.optionsContainer.append($element); diff --git a/js/angular/directive/itemReorderButton.js b/js/angular/directive/itemReorderButton.js index 18bfcf8f94..7c275c5340 100644 --- a/js/angular/directive/itemReorderButton.js +++ b/js/angular/directive/itemReorderButton.js @@ -64,7 +64,7 @@ IonicModule }); }; - var container = angular.element(ITEM_TPL_REORDER_BUTTON); + var container = jqLite(ITEM_TPL_REORDER_BUTTON); container.append($element); itemCtrl.$element.append(container).addClass('item-right-editable'); diff --git a/js/angular/directive/list.js b/js/angular/directive/list.js index c6f71c35c8..94dbbd624b 100644 --- a/js/angular/directive/list.js +++ b/js/angular/directive/list.js @@ -82,7 +82,7 @@ function($animate, $timeout) { require: ['ionList', '^?$ionicScroll'], controller: '$ionicList', compile: function($element, $attr) { - var listEl = angular.element('
') + var listEl = jqLite('
') .append( $element.contents() ); $element.append(listEl); @@ -100,7 +100,7 @@ function($animate, $timeout) { scrollEl: scrollCtrl && scrollCtrl.element, scrollView: scrollCtrl && scrollCtrl.scrollView, onReorder: function(el, oldIndex, newIndex) { - var itemScope = angular.element(el).scope(); + var itemScope = jqLite(el).scope(); if (itemScope && itemScope.$onReorder) { itemScope.$onReorder(oldIndex, newIndex); } @@ -155,16 +155,16 @@ function($animate, $timeout) { }); function toggleNgHide(selector, shouldShow) { - angular.forEach($element[0].querySelectorAll(selector), function(node) { + forEach($element[0].querySelectorAll(selector), function(node) { if (shouldShow) { - $animate.removeClass(angular.element(node), 'ng-hide'); + $animate.removeClass(jqLite(node), 'ng-hide'); } else { - $animate.addClass(angular.element(node), 'ng-hide'); + $animate.addClass(jqLite(node), 'ng-hide'); } }); } function toggleTapDisabled(selector, shouldDisable) { - var el = angular.element($element[0].querySelectorAll(selector)); + var el = jqLite($element[0].querySelectorAll(selector)); if (shouldDisable) { el.attr('data-tap-disabled', 'true'); } else { diff --git a/js/angular/directive/navButtons.js b/js/angular/directive/navButtons.js index b401c85113..6d6dcbee6b 100644 --- a/js/angular/directive/navButtons.js +++ b/js/angular/directive/navButtons.js @@ -49,7 +49,7 @@ IonicModule //so we can remove them all when this element dies - //even if the buttons have changed through an ng-repeat or the like, //we just remove their div parent and they are gone. - var buttons = angular.element('').append(content); + var buttons = jqLite('').append(content); //Compile buttons inside content so they have access to everything //something inside content does (eg parent ionicScroll) diff --git a/js/angular/directive/navView.js b/js/angular/directive/navView.js index 933fdc674d..1f01c17911 100644 --- a/js/angular/directive/navView.js +++ b/js/angular/directive/navView.js @@ -168,7 +168,7 @@ function( $ionicViewService, $state, $compile, $controller, $animate) { return element.append(initialView); } - var newElement = angular.element('
').html(locals.$template).contents(); + var newElement = jqLite('
').html(locals.$template).contents(); var viewRegisterData = renderer().register(newElement); // Remove existing content diff --git a/js/angular/directive/scroll.js b/js/angular/directive/scroll.js index da772199c1..58da440b92 100644 --- a/js/angular/directive/scroll.js +++ b/js/angular/directive/scroll.js @@ -34,7 +34,7 @@ function($timeout, $controller, $ionicBind) { element.addClass('scroll-view'); //We cannot transclude here because it breaks element.data() inheritance on compile - var innerElement = angular.element('
'); + var innerElement = jqLite('
'); innerElement.append(element.contents()); element.append(innerElement); diff --git a/js/angular/directive/slideBox.js b/js/angular/directive/slideBox.js index b3340a8b78..9e421b43e3 100644 --- a/js/angular/directive/slideBox.js +++ b/js/angular/directive/slideBox.js @@ -128,7 +128,7 @@ function($timeout, $compile, $ionicSlideBoxDelegate) { // If the pager should show, append it to the slide box if($scope.$eval($scope.showPager) !== false) { var childScope = $scope.$new(); - var pager = angular.element(''); + var pager = jqLite(''); $element.append(pager); $compile(pager)(childScope); } diff --git a/js/angular/directive/tab.js b/js/angular/directive/tab.js index c7c9eacc8f..7075ff6430 100644 --- a/js/angular/directive/tab.js +++ b/js/angular/directive/tab.js @@ -68,7 +68,7 @@ function($rootScope, $animate, $ionicBind, $compile) { //Remove the contents of the element so we can compile them later, if tab is selected //We don't use regular transclusion because it breaks element inheritance - var tabContent = angular.element('
') + var tabContent = jqLite('
') .append( element.contents().remove() ); return function link($scope, $element, $attr, ctrls) { @@ -111,7 +111,7 @@ function($rootScope, $animate, $ionicBind, $compile) { } } - var tabNavElement = angular.element(tabNavTemplate); + var tabNavElement = jqLite(tabNavTemplate); tabNavElement.data('$ionTabsController', tabsCtrl); tabNavElement.data('$ionTabController', tabCtrl); tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope)); diff --git a/js/angular/directive/tabs.js b/js/angular/directive/tabs.js index aa18c996c5..31f063a41a 100644 --- a/js/angular/directive/tabs.js +++ b/js/angular/directive/tabs.js @@ -54,7 +54,7 @@ IonicModule element.addClass('view'); //We cannot use regular transclude here because it breaks element.data() //inheritance on compile - var innerElement = angular.element('
'); + var innerElement = jqLite('
'); innerElement.append(element.contents()); element.append(innerElement); @@ -68,7 +68,7 @@ IonicModule tabsCtrl.$scope = $scope; tabsCtrl.$element = $element; - tabsCtrl.$tabsElement = angular.element($element[0].querySelector('.tabs')); + tabsCtrl.$tabsElement = jqLite($element[0].querySelector('.tabs')); var el = $element[0]; $scope.$watch(function() { return el.className; }, function(value) { diff --git a/js/angular/directive/toggle.js b/js/angular/directive/toggle.js index 9908789173..9f8eb0a980 100644 --- a/js/angular/directive/toggle.js +++ b/js/angular/directive/toggle.js @@ -68,7 +68,7 @@ function($ionicGesture, $timeout) { track = el.children[1]; handle = track.children[0]; - var ngModelController = angular.element(checkbox).controller('ngModel'); + var ngModelController = jqLite(checkbox).controller('ngModel'); $scope.toggle = new ionic.views.Toggle({ el: el, diff --git a/js/angular/main.js b/js/angular/main.js index b5af9cf86f..6624368a87 100644 --- a/js/angular/main.js +++ b/js/angular/main.js @@ -1,6 +1,5 @@ -var IonicModule = angular.module('ionic', [ - // Angular deps - 'ngAnimate', - 'ngSanitize', - 'ui.router' -]); +var IonicModule = angular.module('ionic', ['ngAnimate', 'ngSanitize', 'ui.router']), + extend = angular.extend, + forEach = angular.forEach, + isString = angular.isString, + jqLite = angular.element; diff --git a/js/angular/service/actionSheet.js b/js/angular/service/actionSheet.js index 1b60da4136..469d8c76c8 100644 --- a/js/angular/service/actionSheet.js +++ b/js/angular/service/actionSheet.js @@ -77,7 +77,7 @@ function($rootScope, $document, $compile, $animate, $timeout, $ionicTemplateLoad show: function(opts) { var scope = $rootScope.$new(true); - angular.extend(scope, { + extend(scope, { cancel: angular.noop, buttonClicked: angular.noop, destructiveButtonClicked: angular.noop @@ -87,7 +87,7 @@ function($rootScope, $document, $compile, $animate, $timeout, $ionicTemplateLoad var element = $compile('')(scope); // Grab the sheet element for animation - var sheetEl = angular.element(element[0].querySelector('.action-sheet-wrapper')); + var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper')); var hideSheet = function(didCancel) { sheetEl.removeClass('action-sheet-up'); diff --git a/js/angular/service/angularOverrides.js b/js/angular/service/angularOverrides.js index 0e9ef4819b..1842e09472 100644 --- a/js/angular/service/angularOverrides.js +++ b/js/angular/service/angularOverrides.js @@ -1,5 +1,5 @@ -angular.element.prototype.addClass = function(cssClasses) { +jqLite.prototype.addClass = function(cssClasses) { var x, y, cssClass, el, splitClasses, existingClasses; if (cssClasses && cssClasses != 'ng-scope' && cssClasses != 'ng-isolate-scope') { for(x=0; x'); + var el = jqLite('
'); var backdropHolds = 0; $document[0].body.appendChild(el[0]); diff --git a/js/angular/service/bind.js b/js/angular/service/bind.js index 6e90f9ff2f..abd7937f3e 100644 --- a/js/angular/service/bind.js +++ b/js/angular/service/bind.js @@ -5,7 +5,7 @@ IonicModule .factory('$ionicBind', ['$parse', '$interpolate', function($parse, $interpolate) { var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/; return function(scope, attrs, bindDefinition) { - angular.forEach(bindDefinition || {}, function (definition, scopeName) { + forEach(bindDefinition || {}, function (definition, scopeName) { //Adapted from angular.js $compile var match = definition.match(LOCAL_REGEXP) || [], attrName = match[3] || scopeName, diff --git a/js/angular/service/modal.js b/js/angular/service/modal.js index d1de50bc1c..ec9c61efbc 100644 --- a/js/angular/service/modal.js +++ b/js/angular/service/modal.js @@ -91,7 +91,7 @@ function($rootScope, $document, $compile, $timeout, $ionicPlatform, $ionicTempla */ show: function() { var self = this; - var modalEl = angular.element(self.modalEl); + var modalEl = jqLite(self.modalEl); self.el.classList.remove('hide'); $timeout(function(){ @@ -139,7 +139,7 @@ function($rootScope, $document, $compile, $timeout, $ionicPlatform, $ionicTempla */ hide: function() { var self = this; - var modalEl = angular.element(self.modalEl); + var modalEl = jqLite(self.modalEl); self.el.classList.remove('active'); modalEl.addClass('ng-leave'); @@ -192,7 +192,7 @@ function($rootScope, $document, $compile, $timeout, $ionicPlatform, $ionicTempla // Create a new scope for the modal var scope = options.scope && options.scope.$new() || $rootScope.$new(true); - angular.extend(scope, { + extend(scope, { $hasHeader: false, $hasSubheader: false, $hasFooter: false, diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index 87a1fa08f1..9558193f7a 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -262,7 +262,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $docume return $ionicPopup; function createPopup(options) { - options = angular.extend({ + options = extend({ scope: null, title: '', buttons: [], @@ -287,7 +287,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $docume //Can't ng-bind-html for popup-body because it can be insecure html //(eg an input in case of prompt) - var body = angular.element(self.element[0].querySelector('.popup-body')); + var body = jqLite(self.element[0].querySelector('.popup-body')); if (content) { body.html(content); $compile(body.contents())(self.scope); @@ -295,7 +295,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $docume body.remove(); } - angular.extend(self.scope, { + extend(self.scope, { title: options.title, buttons: options.buttons, subTitle: options.subTitle, @@ -424,7 +424,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $docume } function showAlert(opts) { - return showPopup( angular.extend({ + return showPopup( extend({ buttons: [{ text: opts.okText || 'OK', type: opts.okType || 'button-positive', @@ -436,7 +436,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $docume } function showConfirm(opts) { - return showPopup( angular.extend({ + return showPopup( extend({ buttons: [{ text: opts.cancelText || 'Cancel' , type: opts.cancelType || 'button-default', @@ -452,7 +452,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $docume function showPrompt(opts) { var scope = $rootScope.$new(true); scope.data = {}; - return showPopup( angular.extend({ + return showPopup( extend({ template: '', scope: scope, diff --git a/js/angular/service/templateLoader.js b/js/angular/service/templateLoader.js index d0b957f764..a1dd5c5cdc 100644 --- a/js/angular/service/templateLoader.js +++ b/js/angular/service/templateLoader.js @@ -21,7 +21,7 @@ function($compile, $controller, $http, $q, $rootScope, $templateCache) { } function loadAndCompile(options) { - options = angular.extend({ + options = extend({ template: '', templateUrl: '', scope: null, @@ -39,19 +39,19 @@ function($compile, $controller, $http, $q, $rootScope, $templateCache) { var scope = options.scope || $rootScope.$new(); //Incase template doesn't have just one root element, do this - var element = angular.element('
').html(template).contents(); + var element = jqLite('
').html(template).contents(); if (options.controller) { controller = $controller( options.controller, - angular.extend(options.locals, { + extend(options.locals, { $scope: scope }) ); element.children().data('$ngControllerController', controller); } if (options.appendTo) { - angular.element(options.appendTo).append(element); + jqLite(options.appendTo).append(element); } $compile(element)(scope);