2014-09-28 4 views
0

나는 컨트롤러가있는 간단한 테이블 페이지와 ng-controller="messageGridCtrl" ng-init="init()"과 같은 init 메소드를 가지고 있고 다른 컨트롤러로 페이지를 생성한다.올바른 경로 변경 컨트롤러는 무엇입니까?

페이지를 만드는 페이지가 <a href="#/messageTemplates">Back to list</a>과 같은 뒤로 링크되어 있는데, 경로를 변경하면 초기화 메소드가 호출되지만 요청이 작동하지 않습니다 (서버에 수신하지 않음). 방금 ​​f5를 통해 다시로드하면 모두 정상적으로 작동합니다.

나는 angularjs를 처음 사용합니다. the angular-route-segment documentation에서

+3

어떤 관련 소스 코드뿐만 아니라 바랍니다 라우팅 모든 서버를 공유 할 수 도움이 될 수 있습니다. – GordyD

답변

0

,

$routeSegmentProvider. 

when('/section1',   's1.home'). 
when('/section1/prefs', 's1.prefs'). 
when('/section1/:id',  's1.itemInfo.overview'). 
when('/section1/:id/edit', 's1.itemInfo.edit'). 
when('/section2',   's2'). 

segment('s1', { 
    templateUrl: 'templates/section1.html', 
    controller: MainCtrl}). 

within(). 

    segment('home', { 
     templateUrl: 'templates/section1/home.html'}). 

    segment('itemInfo', { 
     templateUrl: 'templates/section1/item.html', 
     controller: Section1ItemCtrl, 
     dependencies: ['id']}). 

    within(). 

     segment('overview', { 
      templateUrl: 'templates/section1/item/overview.html'}). 

     segment('edit', { 
      templateUrl: 'templates/section1/item/edit.html'}). 

     up(). 

    segment('prefs', { 
     templateUrl: 'templates/section1/prefs.html'}). 

    up(). 

segment('s2', { 
    templateUrl: 'templates/section2.html', 
    controller: MainCtrl}); 

그것은 당신이

http://scotch.io/tutorials/javascript/angularjs-multi-step-form-using-ui-router