diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 7a5c249786..1877a4ea28 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -23161,7 +23161,7 @@ angular.module('ionic.service.loading', ['ionic.ui.loading']) angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ngAnimate']) -.factory('Modal', ['$rootScope', '$document', '$compile', '$animate', 'TemplateLoader', function($rootScope, $document, $compile, $animate, TemplateLoader) { +.factory('Modal', ['$rootScope', '$document', '$compile', '$animate', '$q', 'TemplateLoader', function($rootScope, $document, $compile, $animate, $q, TemplateLoader) { var ModalView = ionic.views.Modal.inherit({ initialize: function(opts) { ionic.views.Modal.prototype.initialize.call(this, opts); @@ -23228,6 +23228,7 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ngAnimate' }, fromTemplateUrl: function(url, cb, options) { TemplateLoader.load(url).then(function(templateString) { + console.log('TEMPLATE LOADER FORM URL', templateString) var modal = createModal(templateString, options || {}); cb(modal); }); @@ -23392,8 +23393,14 @@ angular.module('ionic.service.templateLoad', []) load: function(url) { var deferred = $q.defer(); - $http.get(url, { cache: $templateCache }).success(function(html) { + $http({ + method: 'GET', + url: url, + cache: $templateCache + }).success(function(html) { deferred.resolve(html && html.trim()); + }).error(function(err) { + deferred.reject(err); }); return deferred.promise; @@ -24520,6 +24527,13 @@ angular.module('ionic.ui.slideBox', []) ; angular.module('ionic.ui.tabs', ['ngAnimate']) +/** + * @description + * + * The Tab Controller renders a set of pages that switch based on taps + * on a tab bar. Modelled off of UITabBarController. + */ + .controller('TabsCtrl', ['$scope', '$element', '$animate', function($scope, $element, $animate) { var _this = this; @@ -24547,15 +24561,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) }; this.select = function(controllerIndex) { - //var oldIndex = _this.getSelectedIndex(); - $scope.activeAnimation = $scope.animation; - /* - if(controllerIndex > oldIndex) { - } else if(controllerIndex < oldIndex) { - $scope.activeAnimation = $scope.animation + '-reverse'; - } - */ _this.selectController(controllerIndex); }; @@ -24673,7 +24679,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) }, template: '' + - '' + + '' + '' + ' {{title}}' + '' diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js index 965c06c10d..a3f2954ebb 100644 --- a/js/ext/angular/src/directive/ionicTabBar.js +++ b/js/ext/angular/src/directive/ionicTabBar.js @@ -1,5 +1,12 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) +/** + * @description + * + * The Tab Controller renders a set of pages that switch based on taps + * on a tab bar. Modelled off of UITabBarController. + */ + .controller('TabsCtrl', ['$scope', '$element', '$animate', function($scope, $element, $animate) { var _this = this; @@ -27,15 +34,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) }; this.select = function(controllerIndex) { - //var oldIndex = _this.getSelectedIndex(); - $scope.activeAnimation = $scope.animation; - /* - if(controllerIndex > oldIndex) { - } else if(controllerIndex < oldIndex) { - $scope.activeAnimation = $scope.animation + '-reverse'; - } - */ _this.selectController(controllerIndex); }; @@ -153,7 +152,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) }, template: '' + - '' + + '' + '' + ' {{title}}' + '' diff --git a/js/ext/angular/src/service/ionicModal.js b/js/ext/angular/src/service/ionicModal.js index f7b544e7b0..f8d13e71ea 100644 --- a/js/ext/angular/src/service/ionicModal.js +++ b/js/ext/angular/src/service/ionicModal.js @@ -1,7 +1,7 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ngAnimate']) -.factory('Modal', ['$rootScope', '$document', '$compile', '$animate', 'TemplateLoader', function($rootScope, $document, $compile, $animate, TemplateLoader) { +.factory('Modal', ['$rootScope', '$document', '$compile', '$animate', '$q', 'TemplateLoader', function($rootScope, $document, $compile, $animate, $q, TemplateLoader) { var ModalView = ionic.views.Modal.inherit({ initialize: function(opts) { ionic.views.Modal.prototype.initialize.call(this, opts); @@ -68,6 +68,7 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ngAnimate' }, fromTemplateUrl: function(url, cb, options) { TemplateLoader.load(url).then(function(templateString) { + console.log('TEMPLATE LOADER FORM URL', templateString) var modal = createModal(templateString, options || {}); cb(modal); }); diff --git a/js/ext/angular/src/service/ionicTemplateLoad.js b/js/ext/angular/src/service/ionicTemplateLoad.js index e536fd632a..65a401f275 100644 --- a/js/ext/angular/src/service/ionicTemplateLoad.js +++ b/js/ext/angular/src/service/ionicTemplateLoad.js @@ -5,8 +5,14 @@ angular.module('ionic.service.templateLoad', []) load: function(url) { var deferred = $q.defer(); - $http.get(url, { cache: $templateCache }).success(function(html) { + $http({ + method: 'GET', + url: url, + cache: $templateCache + }).success(function(html) { deferred.resolve(html && html.trim()); + }).error(function(err) { + deferred.reject(err); }); return deferred.promise; diff --git a/js/ext/angular/test/directive/ionicSideMenu.unit.js b/js/ext/angular/test/directive/ionicSideMenu.unit.js index 21337f110b..633f1c76a3 100644 --- a/js/ext/angular/test/directive/ionicSideMenu.unit.js +++ b/js/ext/angular/test/directive/ionicSideMenu.unit.js @@ -8,7 +8,7 @@ describe('Ionic Angular Side Menu', function() { beforeEach(module('ionic.ui.sideMenu')); beforeEach(inject(function($compile, $rootScope) { - el = $compile('
')($rootScope); + el = $compile('')($rootScope); })); it('Should init', function() { diff --git a/js/ext/angular/test/directive/ionicTabBar.unit.js b/js/ext/angular/test/directive/ionicTabBar.unit.js index 9834db4136..c7e39cc0a2 100644 --- a/js/ext/angular/test/directive/ionicTabBar.unit.js +++ b/js/ext/angular/test/directive/ionicTabBar.unit.js @@ -96,11 +96,12 @@ describe('Tabs directive', function() { element = compile('')(scope); scope = element.scope(); scope.controllers = [ - { text: 'Home', icon: 'icon-home' }, - { text: 'Fun', icon: 'icon-fun' }, - { text: 'Beer', icon: 'icon-beer' }, + { title: 'Home', icon: 'icon-home' }, + { title: 'Fun', icon: 'icon-fun' }, + { title: 'Beer', icon: 'icon-beer' }, ]; scope.$digest(); + console.log(element); expect(element.find('a').length).toBe(3); }); @@ -119,7 +120,7 @@ describe('Tab Item directive', function() { beforeEach(module('ionic.ui.tabs')); - beforeEach(inject(function($compile, $rootScope, $controller) { + beforeEach(inject(function($compile, $rootScope, $document, $controller) { compile = $compile; scope = $rootScope; @@ -127,6 +128,7 @@ describe('Tab Item directive', function() { '' + '')(scope); scope.$digest(); + $document.body.append(element); })); it('Default text works', function() { @@ -137,7 +139,8 @@ describe('Tab Item directive', function() { it('Default icon works', function() { console.log(element); scope.$digest(); - expect(element.find('i').hasClass('icon-default')).toEqual(true); + var i = element[0].querySelector('i'); + expect(angular.element(i).hasClass('icon-default')).toEqual(true); }); it('Click sets correct tab index', function() { diff --git a/js/ext/angular/test/service/ionicModal.unit.js b/js/ext/angular/test/service/ionicModal.unit.js index 0f96ee7b54..285527699a 100644 --- a/js/ext/angular/test/service/ionicModal.unit.js +++ b/js/ext/angular/test/service/ionicModal.unit.js @@ -15,7 +15,7 @@ describe('Ionic Modal', function() { var modalInstance = modal.fromTemplate(template); modalInstance.show(); expect(modalInstance.el.classList.contains('modal')).toBe(true); - expect(modalInstance.el.classList.contains('active')).toBe(true); + expect(modalInstance.el.classList.contains('slide-in-up')).toBe(true); }); it('Should show for dynamic template', function() { @@ -27,7 +27,6 @@ describe('Ionic Modal', function() { done = true; modalInstance.show(); expect(modalInstance.el.classList.contains('modal')).toBe(true); - expect(modalInstance.el.classList.contains('active')).toBe(true); }); waitsFor(function() {