Angular material tabs pagination doesn't change

1.1k views Asked by At

My problem is that when set selectedIndex of mb-tabs from controller, if the selected tabs is not in the first page, it wont change page to show the selected tab.

My template:

<md-content class="md-padding">
    <md-tabs md-selected="selectedIndex" md-dynamic-height >
        <md-tab label="Nuove (2)" >
            <md-content class="md-padding">
                <table cellpadding="0" cellspacing="0" class="c12">
                    <tbody>
                    <tr class="c0">
                        <td>
                            <div><strong>Chiamata{{selectedIndex}}</strong></div>
                        </td>
                        <td>
                            <div><strong>Cliente</strong></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </md-content>
        </md-tab>
        <md-tab label="Oggi (4)" >
            <md-content class="md-padding">
                <table cellpadding="0" cellspacing="0" class="c12">
                    <tbody>
                    <tr class="c0">
                        <td>
                            <div><strong>Chiamata{{selectedIndex}}</strong></div>
                        </td>
                        <td>
                            <div><strong>Cliente</strong></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </md-content>
        </md-tab>
        <md-tab label="Domani (3)" >
            <md-content class="md-padding">
                <table cellpadding="0" cellspacing="0" class="c12">
                    <tbody>
                    <tr class="c0">
                        <td>
                            <div><strong>Chiamata{{selectedIndex}}</strong></div>
                        </td>
                        <td>
                            <div><strong>Cliente</strong></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </md-content>
        </md-tab>
        <md-tab label="Sospese" >
            <md-content class="md-padding">
                <table cellpadding="0" cellspacing="0" class="c12">
                    <tbody>
                    <tr class="c0">
                        <td>
                            <div><strong>Chiamata{{selectedIndex}}</strong></div>
                        </td>
                        <td>
                            <div><strong>Cliente</strong></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </md-content>
        </md-tab>
        <md-tab label="Pianificate (4)" >
            <md-content class="md-padding">
                <table cellpadding="0" cellspacing="0" class="c12">
                    <tbody>
                    <tr class="c0">
                        <td>
                            <div><strong>Chiamata{{selectedIndex}}</strong></div>
                        </td>
                        <td>
                            <div><strong>Cliente</strong></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </md-content>
        </md-tab>
    </md-tabs>

My Controller:

    .controller("ElencoChiamateController", ["$rootScope", "$scope", "$routeParams", "$routeParams", "$location", "$filter", "$timeout", "$interval", "$mdBottomSheet", "$log", function(e, t, n, n, o, r, a, i, d, l) {

    e.id='MIT0650';

    //per posizionarsi al tab selezionato
    switch(n.quale) {
        case 'nuove':
            t.selectedIndex = 0;
            break;
        case 'oggi':
            t.selectedIndex = 1;
            break;
        case 'domani':
            t.selectedIndex = 2;
            break;
        case 'sospese':
            t.selectedIndex = 3;
            break;
        case 'pianificate':
            t.selectedIndex = 4;
            break;
        case 'dsb':
            t.selectedIndex = 5;
            break;
        default: t.selectedIndex = 0;
    }

}])

I thought that it will change the page to show the selected tab, but it wont. I didn't find any options for that, any suggestion?

0

There are 0 answers