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>
Usunąć nawiasy z widoku ui, nie jest to konieczne. Nie wiem, czy to jest problem ... –
@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
@geeks Can proszę dodać config również w swoim plunkr ?? –