我使用多个命名视图来嵌套它们。我想要做的是将调用模板的div中的一些数据传递给模板本身。
像这样的东西
<div ui-view="inputtext" data-value="0"></div>
<div ui-view="inputtext" data-value="1"></div>
<div ui-view="inputtext" data-value="2"></div>我想要相同的模板,但传递不同的数据给它。
我怎样才能做到这一点呢?
这就是我的状态
.state('project', {
url: "/project/:projectId",
views: {
'project' : {
templateUrl: "templates/project.html"
},
'group@project' : {
templateUrl: "templates/group.html"
},
'task-1@project' : {
templateUrl: "templates/task-1.html"
},
'inputtext@project' : {
templateUrl: "templates/modules/inputtext.html"
}
}在'project‘中,我有多个'group’,在'group‘中,我有多个'task’,在'task‘中,我想显示多个'inputtext’,但每个输入值都不同
发布于 2016-08-05 23:41:59
function whatyouwannaget()
{
var scriptUrl = "url";
$.ajax({
url: scriptUrl,
type: 'get',
dataType: 'html',
async: false,
success: function(data) {
result = data;
}
});
return result;发布于 2016-08-05 23:21:46
您可以使用ui-router的stateparams
让你的HTML
<a ui-sref=".detail({id: show.id})">{{show.name}}</a>您的路由配置如下所示。
.state('app.subscribers.detail', {
url: 'detail/:id',
views: {
'detail@app.shows': {
templateUrl: 'templates/partials/show-detail.html',
controller: 'showCtrl'
}
}
});https://stackoverflow.com/questions/38792413
复制相似问题