[英]ui-view is not rendering the corresponding template for angular-ui-tab?
ui-view is not working for ui-tab. ui-view不适用于ui-tab。 Please see the scenario, and kindly tell me where I am wrong.
请看情景,并告诉我我错在哪里。
In customers page, I am calling page update customer, by clicking on any customer customers.view.html , This page contains the list of customers. 在客户页面中,我通过点击任何客户customers.view.html来呼叫页面更新客户 ,此页面包含客户列表。 When I click on any customer, it open the link like the following url.
当我点击任何客户时,它会像下面的网址一样打开链接。
http://localhost:3000/home/#/updatecustomer/5
customers.view.html customers.view.html
<a><i ui-sref="home.updatecustomer({ customerId: {{customer.id}} })" class="fa fa-edit pull-right" ng-click="$event.stopPropagation()"></i></a>
In config, I am creating the url http://localhost:3000/home/#/updatecustomer/5
, I am able to open the page index.html, but view corresponding profile and setting is not opening... 在配置中,我正在创建URL
http://localhost:3000/home/#/updatecustomer/5
,我能够打开页面index.html,但查看相应的配置文件和设置没有打开...
Please see the similar working demo , 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 的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 profile.html
<div>profile of customer </div>
Setting.html Setting.html
<div>Setting for customer </div>
<a><i ui-sref="home.updatecustomer({ customerId: customer.id })" class="fa fa-edit pull-right" ng-click="$event.stopPropagation()"></i></a>
尝试这个atn也提到我有同样的想法希望它有所帮助
There should be customer.id
without braces in ui-sref
在
ui-sref
应该没有大括号的customer.id
<a ui-sref="home.updatecustomer({ customerId: customer.id })" class="pull-right"><i class="fa fa-edit"></i></a>
If you will be able to change your state to home.updatecustomer
then tabs should work. 如果您能够将状态更改为
home.updatecustomer
那么选项卡应该可以正常工作。
Update 更新
Fixed attributes: 固定属性:
ui-sref
to a
tag ui-sref
传递a
标签 pull-right
class to a
tag pull-right
类传递a
标签
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.