How to keep the active tab while navigating to another view?
I'm working on a Cordova/Ionic 2/AngularJS project and I'm facing the following issue. I have defined 5 main navigation tabs with the corresponding views, but I have one view (this one contains an iFrame), which I want to navigate to from any of my main tabs, the problem is I need to keep the active tab selected
My tabs definition look like this:
<ion-tabs ng-controller="BaseTabs as ctrl"
class="tabs-icon-top tabs-color-active-positive"
delegate-handle="tabs">
<ion-tab title="Featured" icon="featured" ng-click="ctrl.openCatalog()"
ui-sref="tab.app-catalog.featured" on-select="ctrl.update()">
<ion-nav-view name="tab-app-home"></ion-nav-view>
</ion-tab>
<ion-tab title="Catalog" icon="shop" ng-click="ctrl.openCatalogSearch()"
ui-sref="tab.app-catalog-search" on-select="ctrl.update()">
<ion-nav-view name="tab-app-catalog-search"></ion-nav-view>
</ion-tab>
...
<ion-tab title="More" icon="more" ng-click="ctrl.openMore()"
ui-sref="tab.app-more-content" on-select="ctrl.update()">
<ion-nav-view name="tab-app-user"></ion-nav-view>
</ion-tab>
</ion-tabs>
in my iframe controller I have the following:
$stateProvider.state(
'tab.app-base-frame', {
url : '/base/frame:url',
parent : 'tab',
views : {
'tab-app-home' : {
templateUrl : 'templates/app/base/frame.html',
controller : 'BaseFrame',
controllerAs : 'ctrl'
}
},
params : {
url : ''
title : false
}
}
)
Since in the controller I have the views set tab-app-home, each time I open the iframe view I get the home tab selected instead of the one active before invoking the iframe.
So here is my question, is there a way to dynamically set the view based on parameters? Or maybe a more practical solution rather than the way I have done so far?
Thanks in advance for the help.
angularjs typescript cordova ionic2 angular-ui-router
add a comment |
I'm working on a Cordova/Ionic 2/AngularJS project and I'm facing the following issue. I have defined 5 main navigation tabs with the corresponding views, but I have one view (this one contains an iFrame), which I want to navigate to from any of my main tabs, the problem is I need to keep the active tab selected
My tabs definition look like this:
<ion-tabs ng-controller="BaseTabs as ctrl"
class="tabs-icon-top tabs-color-active-positive"
delegate-handle="tabs">
<ion-tab title="Featured" icon="featured" ng-click="ctrl.openCatalog()"
ui-sref="tab.app-catalog.featured" on-select="ctrl.update()">
<ion-nav-view name="tab-app-home"></ion-nav-view>
</ion-tab>
<ion-tab title="Catalog" icon="shop" ng-click="ctrl.openCatalogSearch()"
ui-sref="tab.app-catalog-search" on-select="ctrl.update()">
<ion-nav-view name="tab-app-catalog-search"></ion-nav-view>
</ion-tab>
...
<ion-tab title="More" icon="more" ng-click="ctrl.openMore()"
ui-sref="tab.app-more-content" on-select="ctrl.update()">
<ion-nav-view name="tab-app-user"></ion-nav-view>
</ion-tab>
</ion-tabs>
in my iframe controller I have the following:
$stateProvider.state(
'tab.app-base-frame', {
url : '/base/frame:url',
parent : 'tab',
views : {
'tab-app-home' : {
templateUrl : 'templates/app/base/frame.html',
controller : 'BaseFrame',
controllerAs : 'ctrl'
}
},
params : {
url : ''
title : false
}
}
)
Since in the controller I have the views set tab-app-home, each time I open the iframe view I get the home tab selected instead of the one active before invoking the iframe.
So here is my question, is there a way to dynamically set the view based on parameters? Or maybe a more practical solution rather than the way I have done so far?
Thanks in advance for the help.
angularjs typescript cordova ionic2 angular-ui-router
add a comment |
I'm working on a Cordova/Ionic 2/AngularJS project and I'm facing the following issue. I have defined 5 main navigation tabs with the corresponding views, but I have one view (this one contains an iFrame), which I want to navigate to from any of my main tabs, the problem is I need to keep the active tab selected
My tabs definition look like this:
<ion-tabs ng-controller="BaseTabs as ctrl"
class="tabs-icon-top tabs-color-active-positive"
delegate-handle="tabs">
<ion-tab title="Featured" icon="featured" ng-click="ctrl.openCatalog()"
ui-sref="tab.app-catalog.featured" on-select="ctrl.update()">
<ion-nav-view name="tab-app-home"></ion-nav-view>
</ion-tab>
<ion-tab title="Catalog" icon="shop" ng-click="ctrl.openCatalogSearch()"
ui-sref="tab.app-catalog-search" on-select="ctrl.update()">
<ion-nav-view name="tab-app-catalog-search"></ion-nav-view>
</ion-tab>
...
<ion-tab title="More" icon="more" ng-click="ctrl.openMore()"
ui-sref="tab.app-more-content" on-select="ctrl.update()">
<ion-nav-view name="tab-app-user"></ion-nav-view>
</ion-tab>
</ion-tabs>
in my iframe controller I have the following:
$stateProvider.state(
'tab.app-base-frame', {
url : '/base/frame:url',
parent : 'tab',
views : {
'tab-app-home' : {
templateUrl : 'templates/app/base/frame.html',
controller : 'BaseFrame',
controllerAs : 'ctrl'
}
},
params : {
url : ''
title : false
}
}
)
Since in the controller I have the views set tab-app-home, each time I open the iframe view I get the home tab selected instead of the one active before invoking the iframe.
So here is my question, is there a way to dynamically set the view based on parameters? Or maybe a more practical solution rather than the way I have done so far?
Thanks in advance for the help.
angularjs typescript cordova ionic2 angular-ui-router
I'm working on a Cordova/Ionic 2/AngularJS project and I'm facing the following issue. I have defined 5 main navigation tabs with the corresponding views, but I have one view (this one contains an iFrame), which I want to navigate to from any of my main tabs, the problem is I need to keep the active tab selected
My tabs definition look like this:
<ion-tabs ng-controller="BaseTabs as ctrl"
class="tabs-icon-top tabs-color-active-positive"
delegate-handle="tabs">
<ion-tab title="Featured" icon="featured" ng-click="ctrl.openCatalog()"
ui-sref="tab.app-catalog.featured" on-select="ctrl.update()">
<ion-nav-view name="tab-app-home"></ion-nav-view>
</ion-tab>
<ion-tab title="Catalog" icon="shop" ng-click="ctrl.openCatalogSearch()"
ui-sref="tab.app-catalog-search" on-select="ctrl.update()">
<ion-nav-view name="tab-app-catalog-search"></ion-nav-view>
</ion-tab>
...
<ion-tab title="More" icon="more" ng-click="ctrl.openMore()"
ui-sref="tab.app-more-content" on-select="ctrl.update()">
<ion-nav-view name="tab-app-user"></ion-nav-view>
</ion-tab>
</ion-tabs>
in my iframe controller I have the following:
$stateProvider.state(
'tab.app-base-frame', {
url : '/base/frame:url',
parent : 'tab',
views : {
'tab-app-home' : {
templateUrl : 'templates/app/base/frame.html',
controller : 'BaseFrame',
controllerAs : 'ctrl'
}
},
params : {
url : ''
title : false
}
}
)
Since in the controller I have the views set tab-app-home, each time I open the iframe view I get the home tab selected instead of the one active before invoking the iframe.
So here is my question, is there a way to dynamically set the view based on parameters? Or maybe a more practical solution rather than the way I have done so far?
Thanks in advance for the help.
angularjs typescript cordova ionic2 angular-ui-router
angularjs typescript cordova ionic2 angular-ui-router
edited Dec 31 '18 at 16:31
georgeawg
33.2k104968
33.2k104968
asked Dec 31 '18 at 14:13
dr46uldr46ul
11
11
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53988419%2fhow-to-keep-the-active-tab-while-navigating-to-another-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53988419%2fhow-to-keep-the-active-tab-while-navigating-to-another-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown