Toderp signup and nav controller fixes

This commit is contained in:
Max Lynch
2013-10-04 13:31:16 -05:00
parent 065063fc70
commit b12c93f087
8 changed files with 194 additions and 32 deletions

View File

@ -24,6 +24,12 @@ angular.module('ionic.ui.nav', ['ionic.service'])
navBar: {
shouldGoBack: function() {
},
show: function() {
this.isVisible = true;
},
hide: function() {
this.isVisible = false;
},
setTitle: function(title) {
$scope.navController.title = title;
},
@ -57,15 +63,16 @@ angular.module('ionic.ui.nav', ['ionic.service'])
.directive('navBar', function() {
return {
restrict: 'E',
require: '^navController',
require: '^navCtrl',
transclude: true,
replace: true,
scope: true,
template: '<header class="bar bar-header bar-dark nav-bar" ng-class="{hidden: isHidden}">' +
'<a href="#" ng-click="goBack()" class="button" ng-if="controllers.length > 1">Back</a>' +
'<h1 class="title">{{getTopController().title}}</h1>' +
template: '<header class="bar bar-header bar-dark nav-bar" ng-class="{hidden: !navController.navBar.isVisible}">' +
'<a href="#" ng-click="goBack()" class="button" ng-if="navController.controllers.length > 1">Back</a>' +
'<h1 class="title">{{navController.getTopController().title}}</h1>' +
'</header>',
link: function(scope, element, attrs, navCtrl) {
scope.navController = navCtrl;
scope.goBack = function() {
navCtrl.pop();
}
@ -76,9 +83,17 @@ angular.module('ionic.ui.nav', ['ionic.service'])
.directive('navContent', function() {
return {
restrict: 'ECA',
require: '^navCtrl',
scope: true,
link: function(scope, element, attrs) {
link: function(scope, element, attrs, navCtrl) {
scope.title = attrs.title;
if(attrs.navBar === "false") {
navCtrl.hideNavBar();
} else {
navCtrl.showNavBar();
}
scope.isVisible = true;
scope.pushController(scope);

View File

@ -40,12 +40,12 @@
</head>
<body>
<nav-controller>
<nav-ctrl>
<nav-bar></nav-bar>
<content has-header="true" ng-controller="AppCtrl" class="reveal-animation">
</content>
</nav-controller>
</nav-ctrl>
<script src="../../../../dist/ionic.js"></script>
<script src="../../../../dist/ionic-angular.js"></script>
@ -64,7 +64,7 @@
'</div>')(childScope, cb);
}
angular.module('navTest', ['ionic.ui'])
angular.module('navTest', ['ionic.ui.nav'])
.controller('AppCtrl', function($scope, $compile, $element) {
pushIt($scope, $compile, $element, function(cloned, scope) {