How to go to a different web page and make second tab active in that page using ui-sref

56 Views Asked by At

I have a link on the first page and when clicked on that link; it goes to second page. I have two tabs on that second page. I want to make the second tab active and user should directly see the contents of that tab.

I have tried using ui-sref but it only takes me to second page and shows first tab as active. Here's my code:

First Page:

<a class="modal-trigger" ui-sref=""manage_schedule({'tab' : 'current'})">
    <div class="card-action" id="clients-bar">
        More Details
    </div>
</a>

Controller:

$stateProvider
.state('manage_schedule', {
url : "/manage/schedules/:tab",
templateUrl : "/static/manage_schedule.html",
})

Page with tabs:

<div ng-controller="ManageSchedule">
    <div class="tabslayout rules">
        <ul class="tabs">
            <li class="tab col s4" ng-click="getPastRuns(profile_log_url)">
                <a href="#pastschedular" ng-class="{'active' : selectedTab=='past'}">
                    Past Runs({{runDetails.past_total}})
                    <i class="material-icons refresh-center" ng-if="selectedTab=='past'">refresh</i>
                </a>
            </li>
            <li class="tab col s4" ng-click="getRunningSchedules(running_schedules)">
                <a href="#runningschedular" ng-class="{'active' : selectedTab=='current'}">
                    <i class="material-icons refresh-center" ng-if="selectedTab=='current'">refresh</i>
                    Currently Executing Runs ({{runDetails.current_total}})
                </a>
            </li>
        </ul>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $("ul.tabs").tabs({});
    });
</script>
0

There are 0 best solutions below