【发布时间】:2014-09-03 08:04:10
【问题描述】:
我正在使用 UI 路由器构建我的第一个 Angular 应用程序,我需要有关如何在模板加载时执行 http Get 的帮助。谢谢!
我已经设置了一个 plunker: http://embed.plnkr.co/LRSGXqxjtbYcr6rjTj69/preview
我需要传递一个用户 ID 以从数据库中获取正确的信息。
app.controller('SpecsController', function ($scope) {
//I want to get this data with an AJAX call every time specs.html is loaded:
$scope.specsList = [
{ title: 'ISBN', lastModified: '2014-12-12', usedIn: 2, id: '123' },
{ title: 'Brand', lastModified: '2013-11-10', usedIn: 5, id: '456' }
];
});
【问题讨论】:
标签: angularjs angular-ui-router