diff --git a/Gruntfile.js b/Gruntfile.js
index afd1a967be..3883ecf444 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -5,10 +5,11 @@ module.exports = function(grunt) {
concat: {
options: {
- separator: ';'
+ separator: ';\n'
},
dist: {
src: [
+ 'js/_license.js',
// Base
'js/ionic.js',
@@ -31,7 +32,7 @@ module.exports = function(grunt) {
},
distAngular: {
src: [
- 'js/ext/angular/src/*.js'
+ 'js/ext/angular/src/**/*.js'
],
dest: 'dist/<%= pkg.name %>-angular.js'
},
diff --git a/dist/ionic-angular.js b/dist/ionic-angular.js
index e69de29bb2..1e6d56b071 100644
--- a/dist/ionic-angular.js
+++ b/dist/ionic-angular.js
@@ -0,0 +1,321 @@
+angular.module('ionic.ui.content', {})
+
+// The content directive is a core scrollable content area
+// that is part of many View hierarchies
+.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;
+ $scope.hasTabs = attr.hasTabs;
+
+ var newScope = $scope.$parent.$new();
+
+ $element.append(transclude(newScope));
+ };
+ }
+ }
+})
+;
+angular.module('ionic.ui.nav', [])
+
+.controller('NavCtrl', function($scope, $element, $compile) {
+ var _this = this;
+
+ angular.extend(this, ionic.controllers.NavController.prototype);
+
+ ionic.controllers.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) {
+ _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.sideMenu', [])
+
+.controller('SideMenuCtrl', function($scope) {
+ var _this = this;
+
+ angular.extend(this, ionic.controllers.SideMenuController.prototype);
+
+ ionic.controllers.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.tabs', [])
+
+.controller('TabsCtrl', function($scope) {
+ var _this = this;
+
+ angular.extend(this, ionic.controllers.TabBarController.prototype);
+
+ ionic.controllers.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}}' +
+ ''
+ }
+});
+;
+angular.module('ionic.ui', ['ionic.ui.content', 'ionic.ui.tabs', 'ionic.ui.nav', 'ionic.ui.sideMenu']);
diff --git a/dist/ionic-simple.js b/dist/ionic-simple.js
index fdc2fa738a..7b8823303a 100644
--- a/dist/ionic-simple.js
+++ b/dist/ionic-simple.js
@@ -85,6 +85,7 @@
}
})(this, document, ionic);;
+
(function(ionic) {
ionic.registerComponent({
@@ -102,6 +103,7 @@
});
})(ionic);;
+
(function(window, document, ionic) {
ionic.fn = {
@@ -164,6 +166,7 @@
})(this, document, ionic);
;
+
(function(ionic) {
ionic.registerComponent({
@@ -174,30 +177,29 @@
},
init: function(el) {
- if(el) {
+ if(!el) { return; }
- // check if we've already created a Toggle instance for this element
- if(!el.component) {
+ // 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")
- };
+ // 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;
+ // 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;
+ // initialize an instance of a Toggle
+ el.component = new ionic.views.Toggle(opts);
}
+
+ return el.component;
}
});
-})(ionic);
\ No newline at end of file
+})(ionic);
diff --git a/dist/ionic.js b/dist/ionic.js
index 7981acbd10..9488f8a446 100644
--- a/dist/ionic.js
+++ b/dist/ionic.js
@@ -1,3 +1,15 @@
+/*
+Copyright 2013 Drifty Co.
+http://drifty.com/
+
+Ionic - an amazing HTML5 mobile app framework.
+http://ionicframework.com/
+
+By @maxlynch, @helloimben, @adamdbradley <3
+
+Licensed under the MIT license. Please see LICENSE for more information.
+*/
+;
// Create namespaces
window.ionic = {
@@ -5,6 +17,7 @@ window.ionic = {
views: {}
};
;
+
(function(ionic) {
ionic.Animator = {
animate: function(element, className, fn) {
@@ -48,7 +61,8 @@ window.ionic = {
}
};
})(ionic);
-;/**
+;
+/**
* ion-events.js
*
* Author: Max Lynch
@@ -158,7 +172,8 @@ window.ionic = {
//window.addEventListener('click', ionic.EventController.handleClick);
})(window.ionic);
-;/**
+;
+/**
* Simple gesture controllers with some common gestures that emit
* gesture events.
*
@@ -1594,7 +1609,8 @@ window.ionic = {
}
};
})(window.ionic);
-;(function(ionic) {
+;
+(function(ionic) {
ionic.Platform = {
detect: function() {
@@ -1633,7 +1649,8 @@ window.ionic = {
ionic.Platform.detect();
})(window.ionic);
-;(function(window, document, ionic) {
+;
+(function(window, document, ionic) {
// polyfill use to simulate native "tap"
function inputTapPolyfill(ele, e) {
@@ -1689,7 +1706,8 @@ window.ionic = {
ionic.on("tap", tapPolyfill, window);
})(this, document, ionic);
-;(function(ionic) {
+;
+(function(ionic) {
ionic.Utils = {
/**
@@ -1712,6 +1730,7 @@ window.ionic = {
}
})(window.ionic);
;
+
(function(ionic) {
ionic.views.NavBar = function(opts) {
@@ -1756,6 +1775,7 @@ window.ionic = {
})(ionic);
;
+
(function(ionic) {
ionic.views.HeaderBar = function(opts) {
@@ -1784,6 +1804,7 @@ window.ionic = {
})(ionic);
;
+
(function(ionic) {
ionic.views.SideMenu = function(opts) {
@@ -1808,7 +1829,8 @@ window.ionic = {
};
})(ionic);
-;(function(ionic) {
+;
+(function(ionic) {
ionic.views.TabBarItem = function(el) {
this.el = el;
@@ -2010,6 +2032,7 @@ ionic.views.TabBar.prototype = {
})(window.ionic);
;
+
(function(ionic) {
ionic.views.Toggle = function(opts) {
@@ -2083,7 +2106,8 @@ ionic.views.TabBar.prototype = {
};
})(ionic);
-;(function(ionic) {
+;
+(function(ionic) {
ionic.controllers.NavController = function(opts) {
var _this = this;
@@ -2189,7 +2213,8 @@ ionic.controllers.NavController.prototype = {
};
})(window.ionic);
-;/**
+;
+/**
* Adapted from Backbone.js
*/
(function(ionic) {
@@ -2304,6 +2329,7 @@ ionic.controllers.NavController.prototype = {
};
})(window.ionic);
;
+
(function(ionic) {
ionic.controllers.SideMenuController = function(options) {
@@ -2494,7 +2520,8 @@ ionic.controllers.NavController.prototype = {
};
})(ionic);
-;(function(ionic) {
+;
+(function(ionic) {
ionic.controllers.TabBarController = function(options) {
this.tabBar = options.tabBar;
@@ -2616,7 +2643,8 @@ ionic.controllers.TabBarController.prototype = {
}
})(window.ionic);
-;(function(ionic) {
+;
+(function(ionic) {
ionic.ViewController = function(options) {
this.init();
};
diff --git a/js/_license.js b/js/_license.js
new file mode 100644
index 0000000000..bac744f1fb
--- /dev/null
+++ b/js/_license.js
@@ -0,0 +1,11 @@
+/*
+Copyright 2013 Drifty Co.
+http://drifty.com/
+
+Ionic - an amazing HTML5 mobile app framework.
+http://ionicframework.com/
+
+By @maxlynch, @helloimben, @adamdbradley <3
+
+Licensed under the MIT license. Please see LICENSE for more information.
+*/
diff --git a/js/ext/angular/src/ionicAngular.js b/js/ext/angular/src/ionicAngular.js
new file mode 100644
index 0000000000..d9c271aad3
--- /dev/null
+++ b/js/ext/angular/src/ionicAngular.js
@@ -0,0 +1 @@
+angular.module('ionic.ui', ['ionic.ui.content', 'ionic.ui.tabs', 'ionic.ui.nav', 'ionic.ui.sideMenu']);
diff --git a/js/ext/angular/test/nav.html b/js/ext/angular/test/nav.html
index b69c28c8d0..4f0eb87846 100644
--- a/js/ext/angular/test/nav.html
+++ b/js/ext/angular/test/nav.html
@@ -48,8 +48,7 @@
-
-
+