@ma_gr wrote:
My intention is to override a back button on ionic framework to go to a specific page with the second tab button active (Fotos button), showing its content.
It is not working and the first tab button is displayed active. I tried to return the second tab button click event inside $state.go but it did not work. Any suggestion to solve this problem?
Temporada HTML:
<ion-view title="Temporada 2016" id="page1" style="background-color:#FFFFFF;"> <ion-content padding="true" class="has-header"> <div id="temporada2016-button-bar1" class="button-bar"> <button id="temporada2016-button2" style="color:#008BBB;" class="button button-light button-block button-outline" ng-class="{active_news_btn: active_news_btn}" ng-click="activate_news()">Notícias</button> <button id="temporada2016-button3" style="color:#008BBB;" class="button button-light button-block button-outline" ng-class="{active_albums_btn: active_albums_btn}" ng-click="activate_albums()">Fotos</button> </div> <form id="temporada2016-form8" class="list" ng-show="search_news"> <label class="item item-input" name="search_news"> <i class="icon ion-search placeholder-icon"></i> <input type="search" placeholder="Pesquisar Notícia" ng-model="searchNews"> </label> </form> <div class="item item-body list-container" id="temporada2016-list-item-container4" ng-model="item_id" ng-repeat="x in items | filter:searchNews" item="x" href="#/x/{{x.ID}}" ng-click="open_item(x)" ng-show="news_list"> <div id="temporada2016-markdown7" style="margin-top:0px;color:#666666;"> <h2 style="color:#008BBB;">{{ x.TITLE }}</h2> </div> </div> <!--<ion-list class="widget uib_w_1 d-margins" data-uib="ionic/list" data-ver="0"> <ion-item class="item widget uib_w_2" data-uib="ionic/list_item" data-ver="0" ng-repeat="x in items">{{ x.TITLE }}</ion-item> </ion-list>--> <ion-list id="fotos-list4" ng-show="albums_list"> <ion-item class="item-icon-left item-icon-right calm" id="fotos-list-item4" ng-model="album_name" ng-repeat="item in albums" item="item" href="#/item/{{item.FOLDER}}" ng-click="open_album(item)"> <i class="icon ion-images"></i> {{item.FOLDER}} <i class="icon ion-ios-arrow-forward"></i> </ion-item> </ion-list> </ion-content>
Fotos.html
<ion-view title="Fotos ..." id="page8" style="background-color:#FFFFFF;"> <ion-nav-bar class="bar-calm"> <ion-nav-back-button class="button-clear" ng-click="myGoBack()"> <i class="button-icon icon ion-ios-arrow-back"></i> </ion-nav-back-button> </ion-nav-bar> <ion-content padding="true" class="has-header"> <div class="row" ng-repeat="image in images" ng-if="$index % 4 === 0"> <div class="col col-25" ng-if="$index < images.length"> <img class="grid-thumb" ng-src="http://localhost/dashboard/{{images[$index].FILE}}" width="100%" ng-click="showImages($index)" /> </div> <div class="col col-25" ng-if="$index + 1 < images.length"> <img class="grid-thumb" ng-src="http://localhost/dashboard/{{images[$index + 1].FILE}}" width="100%" ng-click="showImages($index+1)" /> </div> <div class="col col-25" ng-if="$index + 2 < images.length"> <img class="grid-thumb" ng-src="http://localhost/dashboard/{{images[$index + 2].FILE}}" width="100%" ng-click="showImages($index+2)" /> </div> <div class="col col-25" ng-if="$index + 3 < images.length"> <img class="grid-thumb" ng-src="http://localhost/dashboard/{{images[$index + 3].FILE}}" width="100%" ng-click="showImages($index+3)" /> </div> </div> </ion-content> </ion-view>
Controller:
.controller('temporada2016Ctrl', ['$scope', '$http', '$state', function ($scope, $http, $state) { $scope.active_news_btn = true; $scope.search_news = true; $scope.news_list = true; $scope.albums_list = false; $scope.activate_albums = function(){ $scope.active_news_btn = false; $scope.active_albums_btn = true; $scope.search_news = false; $scope.news_list = false; $scope.albums_list = true; } $scope.activate_news = function(){ $scope.active_news_btn = true; $scope.active_albums_btn = false; $scope.albums_list = false; $scope.search_news = true; $scope.news_list = true; } ... .controller('fotos2Ctrl', ['$scope', '$state', function ($scope, $state,) { $scope.myGoBack = function(){ $state.go('menu.temporada2016', function(){ return $scope.activate_albums; }); } ...
Routes
.state('menu.temporada2016', { cache: false, url: '/page1', views: { 'side-menu21': { templateUrl: 'templates/temporada2016.html', controller: 'temporada2016Ctrl', params: { dataToTemp: false } } } }) .state('fotos2', { cache: false, url: '/page8', templateUrl: 'templates/fotos2.html', controller: 'fotos2Ctrl', params: { dataToFotos: false }
Posts: 2
Participants: 2