Definition of Ionicframework Routes

Asked

Viewed 455 times

0

I use the tabs to display the contents of an HTML.

<ion-view>
<ion-nav-title align="left">{{cliente}}</ion-nav-title>
<ion-content>

    <ion-tabs class="tabs-striped tabs-color-balanced">
        <ion-tab title="dados">
            <ion-nav-view name="tab-dados"></ion-nav-view>
        </ion-tab>
    </ion-tabs>

</ion-content>

Config

 $stateProvider
    .state('Clientes', {
        url: '/clientes',
        views: {
            'conteudo': {
                templateUrl: "templates/inicio.html",
                controller: 'ClienteController'
            }
        }
    })
    .state('menu',{
        url: '/menu/:dadosLogin',
        views: {
            'conteudo':{
                templateUrl: "templates/menu.html",
                controller: 'ClienteController'
            }
        }
    })
    .state('menu.dados', {
        url:'/acessos',
        views:{
            'tab-dados':{
                templateUrl: "templates/tab-dados.html"
            }
        }
    });

When "tab" appears, it does not list the contents of <ion-nav-view name="tab-dados"></ion-nav-view>,only the "tabs" without content are listed.

1 answer

2

This problem occurred by the (parent) menu hierarchy that is at the highest level not as "Abstract:true" in your statement, so all dependent (children) could not find their responsible to insert the view.

$stateProvider
.state('Clientes', {
    url: '/clientes',
    views: {
        'conteudo': {
            templateUrl: "templates/inicio.html",
            controller: 'ClienteController'
        }
    }
})
.state('menu',{
    url: '/menu',
    abstract: true,
    views: {
        'conteudo':{
            templateUrl: "templates/menu.html"
        }
    }
})
.state('menu.dados', {
    url:'/acessos',
    views:{
        'tab-dados':{
            templateUrl: "templates/tab-dados.html"
        }
    }
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.