Angular cleanup and content working

This commit is contained in:
Max Lynch
2013-10-01 17:34:14 -05:00
parent 4fcad719a3
commit 9100bae246
11 changed files with 615 additions and 235 deletions

View File

@ -0,0 +1,46 @@
angular.module('ionic.ui.content', {})
/*
.directive('content', function() {
return {
restrict: 'E',
replace: true,
template: '<div class="content"></div>'
}
});
*/
/*
.directive('content', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
scope: {
hasHeader: '@',
hasTabs: '@'
},
template: '<div class="content" ng-class="{\'has-header\': hasHeader, \'has-tabs\': hasTabs}" ng-transclude></div>'
}
})
*/
.directive('content', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
scope: true,
template: '<div class="content" ng-class="{\'has-header\': hasHeader, \'has-tabs\': hasTabs}"></div>',
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));
};
}
}
})

View File

@ -1,24 +1,8 @@
angular.module('ionic.ui', ['ngTouch'])
.directive('content', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
scope: true,
template: '<div class="content" ng-class="{\'has-header\': hasHeader, \'has-tabs\': hasTabs}"></div>',
compile: function(element, attr, transclude, navCtrl) {
return function($scope, $element, $attr) {
$scope.hasHeader = attr.hasHeader;
};
}
}
})
angular.module('ionic.ui.nav', ['ionic.ui'])
.controller('NavCtrl', function($scope, $element, $compile) {
var _this = this;
angular.extend(this, ionic.controllers.NavController.prototype);
ionic.controllers.NavController.call(this, {
@ -42,7 +26,6 @@ angular.module('ionic.ui', ['ngTouch'])
}
$scope.pushController = function(controller) {
//console.log('PUSHING OCNTROLLER', controller);
_this.push(controller);
}

View File

@ -1,4 +1,4 @@
angular.module('ionic.ui', [])
angular.module('ionic.ui.sideMenu', [])
.controller('SideMenuCtrl', function($scope) {
var _this = this;

View File

@ -1,17 +1,4 @@
angular.module('ionic.ui', [])
.directive('content', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
scope: {
hasHeader: '@',
hasTabs: '@'
},
template: '<div class="content" ng-class="{\'has-header\': hasHeader, \'has-tabs\': hasTabs}" ng-transclude></div>'
}
})
angular.module('ionic.ui.tabs', ['ionic.ui.content'])
.controller('TabsCtrl', function($scope) {
var _this = this;

View File

@ -1,9 +0,0 @@
angular.module('ionic.ui.content', {})
.directive('content', function() {
return {
restrict: 'E',
replace: true,
template: '<div class="content"></div>'
}
});