mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Fixed initial animation issue
This commit is contained in:
14
js/ext/angular/src/directive/ionicNavRouter.js
vendored
14
js/ext/angular/src/directive/ionicNavRouter.js
vendored
@ -31,16 +31,24 @@ angular.module('ionic.ui.navRouter', [])
|
||||
link: function($scope, $element, $attr) {
|
||||
$scope.animation = $attr.animation;
|
||||
|
||||
$element.addClass('noop-animation');
|
||||
|
||||
var isFirst = true;
|
||||
|
||||
var initTransition = function() {
|
||||
//$element.addClass($scope.animation);
|
||||
};
|
||||
|
||||
var reverseTransition = function() {
|
||||
console.log('REVERSE');
|
||||
$element.removeClass('noop-animation');
|
||||
$element.removeClass($scope.animation);
|
||||
$element.addClass($scope.animation + '-reverse');
|
||||
};
|
||||
|
||||
var forwardTransition = function() {
|
||||
console.log('FORWARD');
|
||||
$element.removeClass('noop-animation');
|
||||
$element.removeClass($scope.animation + '-reverse');
|
||||
$element.addClass($scope.animation);
|
||||
};
|
||||
@ -56,7 +64,7 @@ angular.module('ionic.ui.navRouter', [])
|
||||
|
||||
if(isFirst) {
|
||||
// Don't animate
|
||||
//return;
|
||||
return;
|
||||
}
|
||||
|
||||
if(back) {
|
||||
@ -72,9 +80,7 @@ angular.module('ionic.ui.navRouter', [])
|
||||
$rootScope.actualLocation = $location.path();
|
||||
if(isFirst) {
|
||||
isFirst = false;
|
||||
$timeout(function() {
|
||||
//reverseTransition();
|
||||
}, 200);
|
||||
initTransition();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
<script id="page1.html" type="text/ng-template">
|
||||
<pane>
|
||||
<h1>Page 1</h1>
|
||||
<span>{{num}}</span>
|
||||
<a class="button button-pure" nav-back>Back</a>
|
||||
<a class="button button-assertive" href="#/page2">Next</a>
|
||||
</pane>
|
||||
@ -42,6 +43,7 @@
|
||||
.config(function($routeProvider, $locationProvider) {
|
||||
$routeProvider.when('/page1', {
|
||||
templateUrl: 'page1.html',
|
||||
controller: 'Page1Ctrl'
|
||||
});
|
||||
|
||||
$routeProvider.when('/page2', {
|
||||
@ -58,6 +60,10 @@
|
||||
// configure html5 to get links working on jsfiddle
|
||||
//$locationProvider.html5Mode(true);
|
||||
|
||||
})
|
||||
|
||||
.controller('Page1Ctrl', function($scope) {
|
||||
$scope.num = Math.floor(Math.random() * 100);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user