例如一段以下代码的实现
判断
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>
时间: 2024-11-03 03:42:23