2016-08-12 10 views
5

ui-view nie działa dla ui-tab. Zobacz scenariusz i powiedz mi, gdzie się myliłem.ui-view nie renderuje odpowiedniego szablonu dla kąta-ui-tab?

Na stronie klientów dzwonię do klienta aktualizacji strony, klikając dowolnego klienta: customers.view.html, Ta strona zawiera listę klientów. Po kliknięciu dowolnego klienta otwiera się link podobny do poniższego adresu URL. http://localhost:3000/home/#/updatecustomer/5

customers.view.html

<a><i ui-sref="home.updatecustomer({ customerId: {{customer.id}} })" class="fa fa-edit pull-right" ng-click="$event.stopPropagation()"></i></a> 

W config, tworzę url http://localhost:3000/home/#/updatecustomer/5, jestem w stanie otworzyć stronę index.html, ale widok odpowiadający profil i ustawienie nie jest otwarcie. ..

proszę zobaczyć podobną demonstrację robotniczą, Working DEMO

"config "

.state('home.updatecustomer', { 
    url: 'updatecustomer/:customerId', 
    views:{ 
       '':{ 
        templateUrl: 'addcustomer/index.html', 
        controller: 'TabsDemoCtrl', 
       }, 
       'profile':{ 
        templateUrl: 'addcustomer/profile.html' 
       }, 
       'setting':{ 
        templateUrl: 'addcustomer/setting.html' 
       }, 
      } 
    }) 

Controller

var app = angular.module('app') ; 
    app.controller('TabsDemoCtrl', TabsDemoCtrl); 
    TabsDemoCtrl.$inject = ['$scope', '$state']; 
    function TabsDemoCtrl($scope, $state){ 
     $scope.tabs = [ 
      { title:'profile', view:'profile', active:true }, 
      { title:'setting', view:'setting', active:false } 
     ]; 
    } 

index.html

<uib-tabset active="active"> 
    <uib-tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disable="tab.disabled"> 
     <div ui-view="{{tab.view}}"></div> 
    </uib-tab> 
</uib-tabset> 

profile.html

<div>profile of customer </div> 

Setting.html

<div>Setting for customer </div> 
+0

Usunąć nawiasy z widoku ui, nie jest to konieczne. Nie wiem, czy to jest problem ... –

+0

@GustavoGabriel Usuwam, ale wciąż nie działa, nie sądzę, że to będzie jakiś problem, ponieważ w pracy demo używamy tego samego ... – Guest

+0

@geeks Can proszę dodać config również w swoim plunkr ?? –

Odpowiedz

0

Nie powinno być customer.id bez nawiasów w ui-sref

<a ui-sref="home.updatecustomer({ customerId: customer.id })" class="pull-right"><i class="fa fa-edit"></i></a> 

Jeśli będzie w stanie zmienić swój stan do home.updatecustomer wtedy zaczepy powinny działać.

Aktualizacja

stałe atrybuty:

  • przeszedł ui-sref do a tag
  • przeszedł pull-right klasa a tag
1
<a><i ui-sref="home.updatecustomer({ customerId: customer.id })" class="fa fa-edit pull-right" ng-click="$event.stopPropagation()"></i></a> 

wypróbuj to, co również wspomniałem Mam tę samą myśl, że mam nadzieję, że pomoże

Powiązane problemy