diff --git a/dist/ionic-angular.js b/dist/ionic-angular.js
index d81d2b00b4..e69de29bb2 100644
--- a/dist/ionic-angular.js
+++ b/dist/ionic-angular.js
@@ -1,332 +0,0 @@
-angular.module('ionic.ui.content', {})
-
-.directive('content', function() {
- return {
- restrict: 'E',
- replace: true,
- template: '
'
- }
-});
-;angular.module('ionic.ui', ['ngTouch'])
-
-.directive('content', function() {
- return {
- restrict: 'E',
- replace: true,
- transclude: true,
- scope: true,
- template: '',
- compile: function(element, attr, transclude, navCtrl) {
- return function($scope, $element, $attr) {
- $scope.hasHeader = attr.hasHeader;
- };
- }
- }
-})
-
-.controller('NavCtrl', function($scope, $element, $compile) {
- var _this = this;
-
-
- angular.extend(this, NavController.prototype);
-
- NavController.call(this, {
- content: {
- },
- navBar: {
- shouldGoBack: function() {
- },
- setTitle: function(title) {
- $scope.title = title;
- },
- showBackButton: function(show) {
- },
- }
- });
-
- $scope.controllers = this.controllers;
-
- $scope.getTopController = function() {
- return $scope.controllers[$scope.controllers.length-1];
- }
-
- $scope.pushController = function(controller) {
- //console.log('PUSHING OCNTROLLER', controller);
- _this.push(controller);
- }
-
- $scope.navController = this;
-})
-
-.directive('navController', function() {
- return {
- restrict: 'E',
- replace: true,
- transclude: true,
- controller: 'NavCtrl',
- //templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html',
- template: '',
- compile: function(element, attr, transclude, navCtrl) {
- return function($scope, $element, $attr) {
- };
- }
- }
-})
-
-.directive('navBar', function() {
- return {
- restrict: 'E',
- require: '^navController',
- transclude: true,
- replace: true,
- template: '',
- link: function(scope, element, attrs, navCtrl) {
- scope.goBack = function() {
- navCtrl.pop();
- }
- }
- }
-})
-
-.directive('navContent', function() {
- return {
- restrict: 'ECA',
- scope: true,
- link: function(scope, element, attrs) {
- scope.title = attrs.title;
- scope.isVisible = true;
- scope.pushController(scope);
- }
- }
-});
-;angular.module('ionic.ui', [])
-
-.controller('SideMenuCtrl', function($scope) {
- var _this = this;
-
- angular.extend(this, SideMenuController.prototype);
-
- SideMenuController.call(this, {
- left: {
- width: 270,
- isEnabled: true,
- pushDown: function() {
- $scope.leftZIndex = -1;
- },
- bringUp: function() {
- $scope.leftZIndex = 0;
- }
- },
- right: {
- width: 270,
- isEnabled: true,
- pushDown: function() {
- $scope.rightZIndex = -1;
- },
- bringUp: function() {
- $scope.rightZIndex = 0;
- }
- },
- content: {
- onDrag: function(e) {},
- endDrag: function(e) {},
- getTranslateX: function() {
- /*
- var r = /translate3d\((-?.+)px/;
- var d = r.exec(this.el.style.webkitTransform);
-
- if(d && d.length > 0) {
- return parseFloat(d[1]);
- }
- */
- return $scope.contentTranslateX || 0;
- },
- setTranslateX: function(amount) {
- $scope.contentTranslateX = amount;
- $scope.$apply();
- },
- enableAnimation: function() {
- //this.el.classList.add(this.animateClass);
- $scope.animationEnabled = true;
- },
- disableAnimation: function() {
- //this.el.classList.remove(this.animateClass);
- $scope.animationEnabled = false;
- }
- }
- });
-
- $scope.contentTranslateX = 0;
-})
-
-.directive('sideMenuController', function() {
- return {
- restrict: 'E',
- controller: 'SideMenuCtrl',
- replace: true,
- transclude: true,
- template: '',
- }
-})
-
-.directive('sideMenuContent', function() {
- return {
- restrict: 'CA',
- require: '^sideMenuController',
- compile: function(element, attr, transclude) {
- return function($scope, $element, $attr, sideMenuCtrl) {
- window.ionic.onGesture('drag', function(e) {
- sideMenuCtrl._handleDrag(e);
- }, $element[0]);
-
- window.ionic.onGesture('release', function(e) {
- sideMenuCtrl._endDrag(e);
- }, $element[0]);
-
- $scope.$watch('contentTranslateX', function(value) {
- $element[0].style.webkitTransform = 'translate3d(' + value + 'px, 0, 0)';
- });
-
- $scope.$watch('animationEnabled', function(isAnimationEnabled) {
- if(isAnimationEnabled) {
- $element[0].classList.add('menu-animated');
- } else {
- $element[0].classList.remove('menu-animated');
- }
-
- });
- };
- }
- }
-})
-
-
-.directive('menu', function() {
- return {
- restrict: 'E',
- require: '^sideMenuController',
- replace: true,
- transclude: true,
- scope: true,
- template: '',
- compile: function(element, attr, transclude, sideMenuCtrl) {
- return function($scope, $element, $attr) {
- $scope.side = attr.side;
- };
- }
- }
-})
-;angular.module('ionic.ui', [])
-
-.directive('content', function() {
- return {
- restrict: 'E',
- replace: true,
- transclude: true,
- scope: {
- hasHeader: '@',
- hasTabs: '@'
- },
- template: ''
- }
-})
-
-.controller('TabsCtrl', function($scope) {
- var _this = this;
-
- angular.extend(this, TabBarController.prototype);
-
- TabBarController.call(this, {
- tabBar: {
- tryTabSelect: function() {},
- setSelectedItem: function(index) {
- console.log('TAB BAR SET SELECTED INDEX', index);
- },
- addItem: function(item) {
- console.log('TAB BAR ADD ITEM', item);
- }
- }
- });
-
- $scope.controllers = this.controllers;
-
- $scope.$watch('controllers', function(newV, oldV) {
- console.log("CControlelrs changed", newV, oldV);
- //$scope.$apply();
- });
-})
-
-.directive('tabController', function() {
- return {
- restrict: 'E',
- replace: true,
- scope: {},
- transclude: true,
- controller: 'TabsCtrl',
- //templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html',
- template: '',
- compile: function(element, attr, transclude, tabsCtrl) {
- return function($scope, $element, $attr) {
- };
- }
- }
-})
-
-// Generic controller directive
-.directive('tabContent', function() {
- return {
- restrict: 'CA',
- replace: true,
- transclude: true,
- template: '',
- require: '^tabController',
- scope: true,
- link: function(scope, element, attrs, tabsCtrl) {
- scope.title = attrs.title;
- scope.icon = attrs.icon;
- tabsCtrl.addController(scope);
- }
- }
-})
-
-
-.directive('tabBar', function() {
- return {
- restrict: 'E',
- require: '^tabController',
- transclude: true,
- replace: true,
- scope: true,
- template: '' +
- '' +
- '
'
- }
-})
-
-.directive('tabItem', function() {
- return {
- restrict: 'E',
- replace: true,
- require: '^tabController',
- scope: {
- title: '@',
- icon: '@',
- active: '=',
- tabSelected: '@',
- index: '='
- },
- link: function(scope, element, attrs, tabsCtrl) {
- console.log('Linked item', scope);
- scope.selectTab = function(index) {
- tabsCtrl.selectController(scope.index);
- };
- },
- template:
- '' +
- ' {{title}}' +
- ''
- }
-});
diff --git a/dist/ionic-simple.js b/dist/ionic-simple.js
index fbff374a68..e69de29bb2 100644
--- a/dist/ionic-simple.js
+++ b/dist/ionic-simple.js
@@ -1,207 +0,0 @@
-
-(function(window, document, ionic) {
-
- ionic.Components = [];
-
- ionic.registerComponent = function(instance) {
- ionic.Components.push(instance);
- };
-
- ionic.get = function(elementId) {
- return ionic.component( document.getElementById(elementId) );
- };
-
- ionic.component = function(el) {
- if(el) {
- if(el.component) {
- // this element has already been initialized as a component
- return el.component;
- }
- for(var x = 0; x < ionic.Components.length; x++) {
- if( ionic.Components[x].isComponent(el) ) {
- // this element is a component, init its view
- return ionic.Components[x].init(el);
- }
- }
- }
- };
-
- function componentEvent(eventName, e) {
- if (!e.gesture || !e.gesture.srcEvent || !e.gesture.srcEvent.target) return;
-
- var
- component,
- el = e.gesture.srcEvent.target; // get the original source event's target
-
- while(el) {
- // climb up the tree looking to see if the target
- // is or is in a registered component. If its already
- // been set that its NOT a component don't bother.
- if(el.isComponent !== false) {
- component = ionic.component(el);
- if(component) {
- component[eventName] && component[eventName](e.gesture.srcEvent);
- return;
- }
- // not sure if this element is a component yet,
- // keep climbing up the tree and check again
- // remember that this element is not a component so
- // it can skip this process in the future
- el.isComponent = false;
- }
- el = el.parentElement;
- }
- }
-
- function onTap(e) {
- componentEvent("tap", e);
- }
- ionic.on("tap", onTap, window);
-
- function onDrag(e) {
- componentEvent("drag", e);
- }
- ionic.on("drag", onDrag, window);
-
- function onRelease(e) {
- componentEvent("release", e);
- }
- ionic.on("release", onRelease, window);
-
-
- function initalize() {
- // remove the ready listeners
- document.removeEventListener( "DOMContentLoaded", initalize, false );
- window.removeEventListener( "load", initalize, false );
-
- // trigger that the DOM is ready
- ionic.trigger("domready");
- }
-
- // When the DOM is ready, initalize the webapp
- if ( document.readyState === "complete" ) {
- // DOM is already ready
- setTimeout( initalize );
- } else {
- // DOM isn't ready yet, add event listeners
- document.addEventListener( "DOMContentLoaded", initalize, false );
- window.addEventListener( "load", initalize, false );
- }
-
-})(this, document, ionic);;
-(function(ionic) {
-
- ionic.registerComponent({
-
- name: "listview",
-
- isComponent: function(element) {
- return false;
- },
-
- tap: function(e) {
-
- }
-
- });
-
-})(ionic);;
-(function(window, document, ionic) {
-
- ionic.fn = {
- val: function() {
- var ret, x;
- for(x = 0; x < this.length; x++) {
- ret = this[x].component.val.apply(this[x].component, arguments);
- }
- return ret;
- }
- }
-
- if (window.jQuery) {
- // if jQuery is present then it should be the default
- jq = window.jQuery;
-
- // extend the methods which are in ionic.fn and in jQuery.fn
- for(var name in ionic.fn) {
- var jQueryFn = jq.fn[name];
- jq.fn[name] = function() {
- var
- x,
- ret; // if incase this isn't an ionic component
-
- for(x = 0; x < this.length; x++) {
- ionic.component( this[x] );
- if( this[x].component ) {
- ret = this[x].component[name].apply(this[x].component, arguments);
- }
- }
-
- // if this isn't an ionic component, run the usual jQuery fn
- return jQueryFn.apply(this, arguments);
- }
- }
-
- } else {
- // jQuery is not already present, so use our 'lil version instead
- jq = {
-
- init: function(selector, context) {
- context = context || document;
- var
- x,
- dom = context.querySelectorAll(selector) || [];
- for(x = 0; x < dom.length; x++) {
- ionic.component( dom[x] );
- }
- dom.__proto__ = ionic.fn;
- dom.selector = selector || '';
- return dom;
- }
-
- };
-
- $ = function(selector, context) {
- return jq.init(selector, context);
- }
- }
-
-})(this, document, ionic);
-;
-(function(ionic) {
-
- ionic.registerComponent({
-
- isComponent: function(el) {
- // this is a Toggle component if it has a "toggle" classname
- return el.classList.contains("toggle");
- },
-
- init: function(el) {
- if(el) {
-
- // check if we've already created a Toggle instance for this element
- if(!el.component) {
-
- // find all the required elements that make up a toggle
- var opts = {
- el: el,
- checkbox: el.querySelector("input[type='checkbox']"),
- track: el.querySelector(".track"),
- handle: el.querySelector(".handle")
- };
-
- // validate its a well formed toggle with the required pieces
- if(!opts.checkbox || !opts.track || !opts.handle) return;
-
- // initialize an instance of a Toggle
- el.component = new ionic.views.Toggle(opts);
- }
-
- return el.component;
- }
- }
-
- });
-
-})(ionic);
\ No newline at end of file
diff --git a/dist/ionic.js b/dist/ionic.js
index 7ae84f94a8..bc536e512d 100644
--- a/dist/ionic.js
+++ b/dist/ionic.js
@@ -2111,7 +2111,7 @@ ionic.controllers.NavController.prototype = {
;/**
* Adapted from Backbone.js
*/
-(function(window, document, ionic) {
+(function(ionic) {
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
@@ -2221,7 +2221,7 @@ ionic.controllers.NavController.prototype = {
return matched;
},
};
-})(this, document, ion = this.ionic || {});
+})(window.ionic);
;
(function(ionic) {
@@ -2415,8 +2415,6 @@ ionic.controllers.NavController.prototype = {
})(ionic);
;(function(ionic) {
-ionic.controllers = ionic.controllers || {};
-
ionic.controllers.TabBarController = function(options) {
this.tabBar = options.tabBar;
@@ -2536,7 +2534,7 @@ ionic.controllers.TabBarController.prototype = {
},
}
-})(ionic = window.ionic || {});
+})(window.ionic);
;(function(window, document, ionic) {
// polyfill use to simulate native "tap"
diff --git a/js/controllers/routeController.js b/js/controllers/routeController.js
index c20f12c0a4..81f2cd0f48 100644
--- a/js/controllers/routeController.js
+++ b/js/controllers/routeController.js
@@ -1,7 +1,7 @@
/**
* Adapted from Backbone.js
*/
-(function(window, document, ionic) {
+(function(ionic) {
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
@@ -111,4 +111,4 @@
return matched;
},
};
-})(this, document, ion = this.ionic || {});
+})(window.ionic);
diff --git a/js/controllers/tabBarController.js b/js/controllers/tabBarController.js
index 49ea03c0aa..537e489348 100644
--- a/js/controllers/tabBarController.js
+++ b/js/controllers/tabBarController.js
@@ -1,7 +1,5 @@
(function(ionic) {
-ionic.controllers = ionic.controllers || {};
-
ionic.controllers.TabBarController = function(options) {
this.tabBar = options.tabBar;
@@ -121,4 +119,4 @@ ionic.controllers.TabBarController.prototype = {
},
}
-})(ionic = window.ionic || {});
+})(window.ionic);
diff --git a/js/ext/angular/src/ionicNav.js b/js/ext/angular/src/ionicNav.js
index 9d5e29bc9d..6fa71ef83f 100644
--- a/js/ext/angular/src/ionicNav.js
+++ b/js/ext/angular/src/ionicNav.js
@@ -19,9 +19,9 @@ angular.module('ionic.ui', ['ngTouch'])
var _this = this;
- angular.extend(this, NavController.prototype);
+ angular.extend(this, ionic.controllers.NavController.prototype);
- NavController.call(this, {
+ ionic.controllers.NavController.call(this, {
content: {
},
navBar: {
diff --git a/js/ext/angular/src/ionicSideMenu.js b/js/ext/angular/src/ionicSideMenu.js
index f094d40eb2..a3ec635fd2 100644
--- a/js/ext/angular/src/ionicSideMenu.js
+++ b/js/ext/angular/src/ionicSideMenu.js
@@ -3,9 +3,9 @@ angular.module('ionic.ui', [])
.controller('SideMenuCtrl', function($scope) {
var _this = this;
- angular.extend(this, SideMenuController.prototype);
+ angular.extend(this, ionic.controllers.SideMenuController.prototype);
- SideMenuController.call(this, {
+ ionic.controllers.SideMenuController.call(this, {
left: {
width: 270,
isEnabled: true,
diff --git a/js/ext/angular/src/ionicTabBar.js b/js/ext/angular/src/ionicTabBar.js
index d5e6fa9413..e442a6473a 100644
--- a/js/ext/angular/src/ionicTabBar.js
+++ b/js/ext/angular/src/ionicTabBar.js
@@ -16,9 +16,9 @@ angular.module('ionic.ui', [])
.controller('TabsCtrl', function($scope) {
var _this = this;
- angular.extend(this, TabBarController.prototype);
+ angular.extend(this, ionic.controllers.TabBarController.prototype);
- TabBarController.call(this, {
+ ionic.controllers.TabBarController.call(this, {
tabBar: {
tryTabSelect: function() {},
setSelectedItem: function(index) {
diff --git a/js/ext/angular/test/nav.html b/js/ext/angular/test/nav.html
index d97d3c80dd..e27c1e8feb 100644
--- a/js/ext/angular/test/nav.html
+++ b/js/ext/angular/test/nav.html
@@ -6,7 +6,7 @@
-
+
@@ -47,8 +47,8 @@
-
-
+
+
-
-
-
+
+
+
+
@@ -36,10 +35,8 @@
Right
-
-
-
-
+
+
@@ -51,8 +49,8 @@
-
-
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-