diff --git a/gulpfile.js b/gulpfile.js index 4a8d7942a8..a51604f606 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -60,7 +60,7 @@ gulp.task('docs', function(done) { }); var IS_WATCH = false; -gulp.task('watch', ['bundle'], function() { +gulp.task('watch', ['build'], function() { IS_WATCH = true; gulp.watch('js/**/*.js', ['bundle']); gulp.watch('scss/**/*.scss', ['sass']); @@ -200,7 +200,7 @@ gulp.task('tweet', function() { console.log(tweet); return gulp.src('package.json') .pipe(twitter(oauth, tweet)); - } + } }); gulp.task('docs-index', function() { diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js index 59f6645591..4e1c61c8ce 100644 --- a/js/ext/angular/src/directive/ionicTabBar.js +++ b/js/ext/angular/src/directive/ionicTabBar.js @@ -286,8 +286,8 @@ function($scope, $ionicViewService, $rootScope, $element) { * @param {expression=} on-deselect Called when this tab is deselected. * @param {expression=} ng-click By default, the tab will be selected on click. If ngClick is set, it will not. You can explicitly switch tabs using {@link ionic.service:$ionicTabsDelegate#select $ionicTabsDelegate.select()}. */ -.directive('ionTab', ['$rootScope', '$animate', '$ionicBind', '$compile', '$ionicViewService', -function($rootScope, $animate, $ionicBind, $compile, $ionicViewService) { +.directive('ionTab', ['$rootScope', '$animate', '$ionicBind', '$compile', '$ionicViewService', '$state', '$location', +function($rootScope, $animate, $ionicBind, $compile, $ionicViewService, $state, $location) { //Returns ' key="value"' if value exists function attrStr(k,v) { @@ -372,9 +372,14 @@ function($rootScope, $animate, $ionicBind, $compile, $ionicViewService) { }); function selectTabIfMatchesState() { - // this tab's ui-view is the current one, go to it! - if ($ionicViewService.isCurrentStateNavView($scope.navViewName)) { - tabsCtrl.select($scope); + var href = $attr.href.replace(/^#/, ''); + var stateName = $attr.uiSref.split('(')[0]; + + if ($location.path().indexOf(href) === 0 || $state.includes(stateName)) { + // this tab's ui-view is the current one, go to it! + if ($ionicViewService.isCurrentStateNavView($scope.navViewName)) { + tabsCtrl.select($scope); + } } } };