mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
7
js/angular/service/history.js
vendored
7
js/angular/service/history.js
vendored
@@ -284,7 +284,7 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
|
||||
|
||||
// create an element from the viewLocals template
|
||||
ele = $ionicViewSwitcher.createViewEle(viewLocals);
|
||||
if (this.isAbstractEle(ele)) {
|
||||
if (this.isAbstractEle(ele, viewLocals)) {
|
||||
console.log('VIEW', 'abstractView', DIRECTION_NONE, viewHistory.currentView);
|
||||
return {
|
||||
action: 'abstractView',
|
||||
@@ -651,7 +651,10 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
|
||||
return nextViewOptions;
|
||||
},
|
||||
|
||||
isAbstractEle: function(ele) {
|
||||
isAbstractEle: function(ele, viewLocals) {
|
||||
if (viewLocals && viewLocals.$$state && viewLocals.$$state.self.abstract) {
|
||||
return true;
|
||||
}
|
||||
return !!(ele && (isAbstractTag(ele) || isAbstractTag(ele.children())));
|
||||
},
|
||||
|
||||
|
||||
@@ -1078,6 +1078,25 @@ describe('Ionic History', function() {
|
||||
expect($ionicHistory.isAbstractEle(div)).toBe(true);
|
||||
}));
|
||||
|
||||
it('should should be an abstract element from the viewLocals', inject(function($ionicHistory, $document) {
|
||||
var div = angular.element('<div>');
|
||||
var viewLocals = {
|
||||
$$state: {
|
||||
self: {
|
||||
abstract: true
|
||||
}
|
||||
}
|
||||
};
|
||||
expect($ionicHistory.isAbstractEle(div, viewLocals)).toBe(true);
|
||||
|
||||
var viewLocals = {
|
||||
$$state: {
|
||||
self: {}
|
||||
}
|
||||
};
|
||||
expect($ionicHistory.isAbstractEle(div, viewLocals)).toBe(false);
|
||||
}));
|
||||
|
||||
it('should be an abstract view', inject(function($document) {
|
||||
var reg = ionicHistory.register({}, {
|
||||
$template: '<ion-tabs></ion-tabs>'
|
||||
|
||||
Reference in New Issue
Block a user