【发布时间】:2015-02-11 19:32:44
【问题描述】:
更新:
在我的 html 页面上,我使用如下:
<section ng-repeat="template in templates">
<ng-include src="template"></ng-include>
</section>
但问题是我需要特定顺序的特定文件,所以有没有办法可以控制顺序呈现的方式?
我正在尝试订购一个对象,我该怎么做,我已经在网上搜索过,然后才在这里发布。
function MyCtrl($scope) {
$scope.templates = {
template_address: "../template/address.html",
template_book: "../template/book.html",
template_create: "../template/create.html"
};
<div ng-app ng-controller="MyCtrl">
<ul>
<li ng-repeat="(name, path) in templates">{{name}}: {{path}}</li>
</ul>
</div>
【问题讨论】:
-
你想按什么顺序排列它们?他们已经准备好了。
标签: angularjs angularjs-ng-repeat ng-repeat