我想提出一个单页应用程序的链接后Angularjs更新一下表格与参数
我的配置:
var app = angular.module('menuCardMaker', ['ngRoute']);
app.config(function ($routeProvider, $locationProvider) {
$routeProvider
.when('/wines', {
templateUrl: 'templates/wine/wine.html',
controller: 'WineController'
})
.when('/wines/delete/:id', {
templateUrl: 'templates/wine/wine.html',
controller: 'WineController'
})
我的HTML:
<table>
<tr>
<td class="head">Name</td>
</tr>
<tr ng-repeat="wine in winesFromStorage">
<td>{{ wine.name }}</td>
<td><a ng-href="#/wines/delete/{{ wine.id }}" ng-click="remove()">Delete</a></td>
</tr>
</table>
的URL页面负载(例如)http://127.0.0.1:8080/#/wines/delete/1当用户点击删除。它会删除LocalStorage中的记录,但它不会像我期望从我的配置中的templateUrl那样“刷新”我的页面。
用户必须在表格显示正确的数据之前重新加载页面。任何想法可以指导我解决问题?
这应该工作。但是,我的页面加载/葡萄酒/与表,当按下删除它指向/葡萄酒/删除/ 1。所以它看起来像它保持/葡萄酒/并且它不更新数据。有任何想法吗? 我喜欢这个想法比上面的更好! – Bilzard