mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Nav WIP
This commit is contained in:
84
dist/js/ionic-angular.js
vendored
84
dist/js/ionic-angular.js
vendored
@ -645,47 +645,56 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges
|
|||||||
return {
|
return {
|
||||||
restrict: 'ECA',
|
restrict: 'ECA',
|
||||||
require: '^navs',
|
require: '^navs',
|
||||||
scope: true,
|
|
||||||
transclude: 'element',
|
transclude: 'element',
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr, navCtrl) {
|
return function($scope, $element, $attr, navCtrl) {
|
||||||
var lastParent, lastIndex, childScope, childElement;
|
var lastParent, lastIndex, childScope, childElement;
|
||||||
|
|
||||||
$scope.title = $attr.title;
|
|
||||||
$scope.slideAnimation = $attr.slideAnimation || '';
|
|
||||||
$scope.slideTitleAnimation = $attr.slideTitleAnimation || '';
|
|
||||||
|
|
||||||
if($attr.navBar === "false") {
|
|
||||||
navCtrl.hideNavBar();
|
|
||||||
} else {
|
|
||||||
navCtrl.showNavBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.pushController($scope, $element);
|
|
||||||
|
|
||||||
var title = angular.element($element.parent().parent().parent()[0].querySelector('.title'));
|
|
||||||
var newTitle = angular.element(title.clone());
|
|
||||||
|
|
||||||
$compile(newTitle)($scope);
|
|
||||||
|
|
||||||
title.after(newTitle);
|
|
||||||
|
|
||||||
console.log(newTitle);
|
|
||||||
|
|
||||||
$animate.addClass(newTitle, $scope.slideTitleAnimation, function() {
|
|
||||||
$animate.removeClass(newTitle, $scope.slideTitleAnimation, function() {
|
|
||||||
newTitle.scope().$destroy();
|
|
||||||
newTitle.remove();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$watch('isVisible', function(value) {
|
$scope.$watch('isVisible', function(value) {
|
||||||
|
// Taken from ngIf
|
||||||
|
if(childElement) {
|
||||||
|
$animate.leave(childElement);
|
||||||
|
childElement = undefined;
|
||||||
|
}
|
||||||
|
if(childScope) {
|
||||||
|
childScope.$destroy();
|
||||||
|
childScope = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if(value) {
|
if(value) {
|
||||||
childScope = $scope.$new();
|
childScope = $scope;
|
||||||
transclude(childScope, function(clone) {
|
transclude(childScope, function(clone) {
|
||||||
childElement = clone;
|
childElement = clone;
|
||||||
|
|
||||||
clone.addClass($scope.slideAnimation);
|
childScope.title = $attr.title;
|
||||||
|
childScope.slideAnimation = $attr.slideAnimation || '';
|
||||||
|
childScope.slideTitleAnimation = $attr.slideTitleAnimation || '';
|
||||||
|
|
||||||
|
if($attr.navBar === "false") {
|
||||||
|
navCtrl.hideNavBar();
|
||||||
|
} else {
|
||||||
|
navCtrl.showNavBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
childScope.pushController(childScope, $element);
|
||||||
|
|
||||||
|
var title = angular.element($element.parent().parent().parent()[0].querySelector('.title'));
|
||||||
|
var newTitle = angular.element(title.clone());
|
||||||
|
|
||||||
|
$compile(newTitle)(childScope);
|
||||||
|
|
||||||
|
title.after(newTitle);
|
||||||
|
|
||||||
|
console.log(newTitle);
|
||||||
|
|
||||||
|
clone.addClass(childScope.slideAnimation);
|
||||||
|
|
||||||
|
$animate.addClass(newTitle, childScope.slideTitleAnimation, function() {
|
||||||
|
$animate.removeClass(newTitle, childScope.slideTitleAnimation, function() {
|
||||||
|
newTitle.scope().$destroy();
|
||||||
|
newTitle.remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Gesture.on('drag', function(e) {
|
Gesture.on('drag', function(e) {
|
||||||
@ -700,20 +709,11 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges
|
|||||||
|
|
||||||
var title = $element.parent().parent().parent()[0].querySelector('.title');
|
var title = $element.parent().parent().parent()[0].querySelector('.title');
|
||||||
$animate.enter(clone, $element.parent(), $element);
|
$animate.enter(clone, $element.parent(), $element);
|
||||||
$animate.addClass(angular.element(title), $scope.slideTitleAnimation, function() {
|
$animate.addClass(angular.element(title), childScope.slideTitleAnimation, function() {
|
||||||
$animate.removeClass(angular.element(title), $scope.slideTitleAnimation, function() {
|
$animate.removeClass(angular.element(title), childScope.slideTitleAnimation, function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
if(childElement) {
|
|
||||||
$animate.leave(childElement);
|
|
||||||
childElement = undefined;
|
|
||||||
}
|
|
||||||
if(childScope) {
|
|
||||||
childScope.$destroy();
|
|
||||||
childScope = undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
84
js/ext/angular/src/directive/ionicNav.js
vendored
84
js/ext/angular/src/directive/ionicNav.js
vendored
@ -100,47 +100,56 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges
|
|||||||
return {
|
return {
|
||||||
restrict: 'ECA',
|
restrict: 'ECA',
|
||||||
require: '^navs',
|
require: '^navs',
|
||||||
scope: true,
|
|
||||||
transclude: 'element',
|
transclude: 'element',
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr, navCtrl) {
|
return function($scope, $element, $attr, navCtrl) {
|
||||||
var lastParent, lastIndex, childScope, childElement;
|
var lastParent, lastIndex, childScope, childElement;
|
||||||
|
|
||||||
$scope.title = $attr.title;
|
|
||||||
$scope.slideAnimation = $attr.slideAnimation || '';
|
|
||||||
$scope.slideTitleAnimation = $attr.slideTitleAnimation || '';
|
|
||||||
|
|
||||||
if($attr.navBar === "false") {
|
|
||||||
navCtrl.hideNavBar();
|
|
||||||
} else {
|
|
||||||
navCtrl.showNavBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.pushController($scope, $element);
|
|
||||||
|
|
||||||
var title = angular.element($element.parent().parent().parent()[0].querySelector('.title'));
|
|
||||||
var newTitle = angular.element(title.clone());
|
|
||||||
|
|
||||||
$compile(newTitle)($scope);
|
|
||||||
|
|
||||||
title.after(newTitle);
|
|
||||||
|
|
||||||
console.log(newTitle);
|
|
||||||
|
|
||||||
$animate.addClass(newTitle, $scope.slideTitleAnimation, function() {
|
|
||||||
$animate.removeClass(newTitle, $scope.slideTitleAnimation, function() {
|
|
||||||
newTitle.scope().$destroy();
|
|
||||||
newTitle.remove();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$watch('isVisible', function(value) {
|
$scope.$watch('isVisible', function(value) {
|
||||||
|
// Taken from ngIf
|
||||||
|
if(childElement) {
|
||||||
|
$animate.leave(childElement);
|
||||||
|
childElement = undefined;
|
||||||
|
}
|
||||||
|
if(childScope) {
|
||||||
|
childScope.$destroy();
|
||||||
|
childScope = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if(value) {
|
if(value) {
|
||||||
childScope = $scope.$new();
|
childScope = $scope;
|
||||||
transclude(childScope, function(clone) {
|
transclude(childScope, function(clone) {
|
||||||
childElement = clone;
|
childElement = clone;
|
||||||
|
|
||||||
clone.addClass($scope.slideAnimation);
|
childScope.title = $attr.title;
|
||||||
|
childScope.slideAnimation = $attr.slideAnimation || '';
|
||||||
|
childScope.slideTitleAnimation = $attr.slideTitleAnimation || '';
|
||||||
|
|
||||||
|
if($attr.navBar === "false") {
|
||||||
|
navCtrl.hideNavBar();
|
||||||
|
} else {
|
||||||
|
navCtrl.showNavBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
childScope.pushController(childScope, $element);
|
||||||
|
|
||||||
|
var title = angular.element($element.parent().parent().parent()[0].querySelector('.title'));
|
||||||
|
var newTitle = angular.element(title.clone());
|
||||||
|
|
||||||
|
$compile(newTitle)(childScope);
|
||||||
|
|
||||||
|
title.after(newTitle);
|
||||||
|
|
||||||
|
console.log(newTitle);
|
||||||
|
|
||||||
|
clone.addClass(childScope.slideAnimation);
|
||||||
|
|
||||||
|
$animate.addClass(newTitle, childScope.slideTitleAnimation, function() {
|
||||||
|
$animate.removeClass(newTitle, childScope.slideTitleAnimation, function() {
|
||||||
|
newTitle.scope().$destroy();
|
||||||
|
newTitle.remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Gesture.on('drag', function(e) {
|
Gesture.on('drag', function(e) {
|
||||||
@ -155,20 +164,11 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges
|
|||||||
|
|
||||||
var title = $element.parent().parent().parent()[0].querySelector('.title');
|
var title = $element.parent().parent().parent()[0].querySelector('.title');
|
||||||
$animate.enter(clone, $element.parent(), $element);
|
$animate.enter(clone, $element.parent(), $element);
|
||||||
$animate.addClass(angular.element(title), $scope.slideTitleAnimation, function() {
|
$animate.addClass(angular.element(title), childScope.slideTitleAnimation, function() {
|
||||||
$animate.removeClass(angular.element(title), $scope.slideTitleAnimation, function() {
|
$animate.removeClass(angular.element(title), childScope.slideTitleAnimation, function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
if(childElement) {
|
|
||||||
$animate.leave(childElement);
|
|
||||||
childElement = undefined;
|
|
||||||
}
|
|
||||||
if(childScope) {
|
|
||||||
childScope.$destroy();
|
|
||||||
childScope = undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,6 @@
|
|||||||
.controller('CatsCtrl', function($scope, $compile, $element) {
|
.controller('CatsCtrl', function($scope, $compile, $element) {
|
||||||
console.log('Cats', $element);
|
console.log('Cats', $element);
|
||||||
$scope.goNext = function() {
|
$scope.goNext = function() {
|
||||||
$scope.isVisible = false;
|
|
||||||
$scope.navController.pushFromTemplate('page.html');
|
$scope.navController.pushFromTemplate('page.html');
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user