2016-04-30 90 views
0

离子sidemenu默认应用程序创建和地图和标记点击拖拽页面添加在菜单列表中。地图工作正常,但MarkerClick不是。当点击MarkerClick表单旁边菜单时,这个重定向到最后一个活动页面。离子页面导航不起作用

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

.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

回答

0

尝试更换与UI-SREF = “app.markerClick” UI HREF -Router提供了允许链接的ui-sref到各州。这与链接到普通URL不同。使用UI-Router时,您想链接到一个状态,而不是URL。

+0

谢谢。现在正在工作 – Souras

+0

请相应标记答案 –