mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refactor(): reorganize source files
This commit is contained in:
27
js/angular/controller/tabController.js
vendored
Normal file
27
js/angular/controller/tabController.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
IonicModule
|
||||
.controller('$ionicTab', [
|
||||
'$scope',
|
||||
'$ionicViewService',
|
||||
'$attrs',
|
||||
'$location',
|
||||
'$state',
|
||||
function($scope, $ionicViewService, $attrs, $location, $state) {
|
||||
this.$scope = $scope;
|
||||
|
||||
//All of these exposed for testing
|
||||
this.hrefMatchesState = function() {
|
||||
return $attrs.href && $location.path().indexOf(
|
||||
$attrs.href.replace(/^#/, '').replace(/\/$/, '')
|
||||
) === 0;
|
||||
};
|
||||
this.srefMatchesState = function() {
|
||||
return $attrs.uiSref && $state.includes( $attrs.uiSref.split('(')[0] );
|
||||
};
|
||||
this.navNameMatchesState = function() {
|
||||
return this.navViewName && $ionicViewService.isCurrentStateNavView(this.navViewName);
|
||||
};
|
||||
|
||||
this.tabMatchesState = function() {
|
||||
return this.hrefMatchesState() || this.srefMatchesState() || this.navNameMatchesState();
|
||||
};
|
||||
}]);
|
||||
Reference in New Issue
Block a user