标签:
例如一段以下代码的实现
判断
ejs
<% if (data.success) { %>
<span><%= data.success %></span>
<% } %>
<% if (data.err) { %>
<span><%= data.err %></span>
<% } %>
angularjs
<span>{{ data.success }}</span>
<span>{{ data.err }}</span>
遍历
var arrs = [{name:a, age:10}, {name:b, age:20}];
ejs
<% arrs.forEach(function (v, k){ %>
<span><%= v.name %></span>
<span><%= v.age %></span>
<% }) %>
angularjs
<div ng-repeat="arr in arrs">
<span>{{ arr.name }}</span>
<span>{{ arr.age }}</span>
</div>
标签:
原文地址:http://www.cnblogs.com/smallstupidwife/p/4824538.html