【发布时间】:2019-06-18 14:52:43
【问题描述】:
我有很多 html 页面,并决定使用它们的名称(简短且唯一)作为 id,所以当我想点击表格的一行时,id(即文件名)被传递到模板URL。例如,
app.config(function($routeProvider) {
$routeProvider
.when("/post/:id",
{
title: 'Disease',
templateUrl : "/pages/posts/:id.html"
})
例如,我的列表中有 Treponema.html、HeartDisease.html、LungCancer.html 等。当我单击一个时,它应该在页面右侧显示其内容,我已在该页面上声明:
<div ng-view></div>
当我点击一个列出的项目时,我会将它们的 id 作为名称(HearDisease、LungCancer)并将其放在 templateUrl 中。
<div id="HeartDisease"
onclick="window.location.href ='/post/'+this.id+'.html';>
<p>HeartDisease.html</p>
</div>
【问题讨论】:
标签: angularjs ngroute ng-view pass-data