简体   繁体   English

离子页面导航不起作用

[英]Ionic Page Navigation is not working

Ionic sidemenu default app created and map and markerClick tow page was add ed in menu list. 创建了Ionic sidemenu默认应用,并在菜单列表中添加了map和markerClick拖曳页面。 Map is working fine but MarkerClick is not. 地图工作正常,但MarkerClick不能正常运行。 When click on MarkerClick form sidemenu this redirect on last active page. 当单击MarkerClick表单侧面菜单时,此重定向将在最后一个活动页面上。

menu.html menu.html

 <ion-side-menu side="left">
    <ion-header-bar class="bar-stable">
        <h1 class="title">Left</h1>
    </ion-header-bar>
    <ion-content>
        <ion-list>
            <ion-item menu-close ng-click="login()">
                Login
            </ion-item>
            <ion-item menu-close href="#/app/search">
                Search
            </ion-item>
            <ion-item menu-close href="#/app/browse">
                Browse
            </ion-item>
            <ion-item menu-close href="#/app/playlists">
                Playlists
            </ion-item>
            <ion-item menu-close href="#/app/map">
                Map
            </ion-item>
            <ion-item menu-close href="#/app/markerClick">
                Marker
            </ion-item>
        </ion-list>
    </ion-content>
</ion-side-menu>

app.js app.js

.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider

    .state('app', {
        url: '/app',
        abstract: true,
        templateUrl: 'templates/menu.html',
        controller: 'AppCtrl'
    })
    .state('app.search', {
        url: '/search',
        views: {
            'menuContent': {
                templateUrl: 'templates/search.html'
            }
        }
    })
    .state('app.browse', {
        url: '/browse',
        views: {
            'menuContent': {
                templateUrl: 'templates/browse.html'
            }
        }
    })
    .state('app.playlists', {
        url: '/playlists',
        views: {
            'menuContent': {
                templateUrl: 'templates/playlists.html',
                controller: 'PlaylistsCtrl'
            }
        }
    })
    .state('app.single', {
        url: '/playlists/:playlistId',
        views: {
            'menuContent': {
                templateUrl: 'templates/playlist.html',
                controller: 'PlaylistCtrl'
            }
        }
    })
    .state('app.map', {
        url: '/map',
        views: {
            'menuContent': {
                templateUrl: 'templates/map.html',
                controller: 'MapCtrl'
            }
        }
    })
    .state('app.markerClick', {
        url: '/markerClick',
        view: {
            'menuContent': {
                //templateUrl: '<h1>what the hello</h1>',
                templateUrl: 'templates/testTemplate.html',
                controller: 'markerClickCtr'
            }
        }
    });
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/map');
});

enter image description here 在此处输入图片说明

enter image description here 在此处输入图片说明

Try to replace href with ui-sref="app.markerClick" UI-Router provides ui-sref which allows to link to states. 尝试将href替换为ui-sref =“ app.markerClick” UI-Router提供了ui-sref,它允许链接到各州。 This is different than linking to a normal URL. 这不同于链接到普通URL。 When using UI-Router you want to link to a state, not a URL. 使用UI-Router时,您要链接到状态而不是URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM