php - onclick url未定义的Angular js
问题描述
显示专辑列表,但我希望能够单击表中的专辑并在同一页面上显示曲目列表。当我这样做时,网址显示“ http://localhost/cm0665-assignment/#/album/undefined ”。
我认为这与“专辑代码”有关。但不确定该怎么做。
javascript
$scope.selectedalbum = {};
$scope.selectAlbum = function ($event, album){
$scope.selectedAlbum = album;
$location.path('/album/' + album.albumCode);
};
html
<table>
<tr data-ng-repeat="album in albums"
data-ng-click="selectAlbum($event, album)"
data-ng-class="{'selected':selectedAlbum.albumCode===album.album_id}"
style="cursor: pointer;">
<td>{{album.album_id}}</td><td>{{album.Name}}</td>
</tr>
</table>
解决方案
推荐阅读
- java - Java 堆空间错误 | 双向链表
- javascript - 根据最长的标记序列对项目列表进行分组
- spring - 调用 API 时不想重复生成对象
- flutter - Flutter 提供程序未更新状态
- python - 在基于颜色聚类的图中绘制节点
- android - 尝试构建android应用程序时反应本机错误
- sonarqube - GitLab SonarQube CI/CD 变量未传递到管道
- amazon-web-services - 尝试运行 datomic + clojure 项目时出错
- excel - 用公式分离 Excel 中的数据
- json - Scala中的条件json解析