0
我正在用UI路由器构建我的第一个Angular应用程序,我需要关于如何在模板加载时执行http获取的帮助。谢谢!http GET和AngularJS UI路由器
我已经成立了一个plunker: http://embed.plnkr.co/LRSGXqxjtbYcr6rjTj69/preview
我需要通过一个用户ID来从DB获得正确的信息。
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' }
];
});
感谢。我全都是新手,所以我需要一个更具体的例子来确定我害怕做什么。 – peta 2014-09-03 08:32:00
看到答案,编辑 – gaskar 2014-09-03 09:14:41
谢谢。我很感激。有些东西不起作用。这些项目未列出。我使用listSpecs.html作为数据。请你能快速看看我的Plunker:http://embed.plnkr.co/LRSGXqxjtbYcr6rjTj69/ – peta 2014-09-04 09:03:14