2016-03-22 17 views
0

: Ben http://localhost/search isabet yapmaya çalışırkenKöşeli UI Yönlendirici Url '/' ile ebeveyn durumu için iç içe bir durum oluşturulamıyor, ancak ''/'' ile bir üst öğe oluşuyor mu? Ben gibi bir yönlendirici yapılandırmasını tanımlayan am mı

export function routerConfig($stateProvider, $urlRouterProvider, $locationProvider) { 
    'ngInject'; 
    $locationProvider.html5Mode(true); 

    $stateProvider 
    .state('myapp', { 
     url: '/', 
     templateUrl: 'app/main/main.html', 
     controller: 'MainController', 
     controllerAs: 'main' 
    }) 
    .state('searchResults', { 
     url: '/search', 
     parent: 'myapp', 
     templateUrl: 'app/search-results/search-results.html', 
     controller: 'SearchResultsController', 
     controllerAs: 'srchRes' 

    }); 

    $urlRouterProvider.otherwise('/'); 
} 

, ben http://localhost yönlendiriliyorum ediyorum. Sebebini neden bilmiyorum?

Ama bu kod çalışıyor:

export function routerConfig($stateProvider, $urlRouterProvider, $locationProvider) { 
    'ngInject'; 
    $locationProvider.html5Mode(true); 

    $stateProvider 
    .state('myapp', { 
     url: '/myapp', 
     templateUrl: 'app/main/main.html', 
     controller: 'MainController', 
     controllerAs: 'main' 
    }) 
    .state('searchResults', { 
     url: '/search', 
     parent: 'myapp', 
     templateUrl: 'app/search-results/search-results.html', 
     controller: 'SearchResultsController', 
     controllerAs: 'srchRes' 

    }); 

    $urlRouterProvider.otherwise('/'); 
} 

Şimdi http://localhost/myapp/search mükemmel çalışıyor ne zaman.

İç içe geçmiş durumlar "/" köküne ayarlanmış "url" özelliği olan durumlar dışında oluşturulamıyor mu?

cevap

1

Ben url özelliği opsiyonel olduğuna inanıyoruz ve ebeveyn çıkarın eğer

+0

teşekkür ederiz herhangi bir sorun olmadan çocuğa gezinmek mümkün olmalıdır. Mükemmel çalıştı. – jackOfAll

İlgili konular