gpt4 book ai didi

javascript - 出现 ngRepeat 错误(错误 : ngRepeat:iidexp Invalid Identifier)

转载 作者:行者123 更新时间:2023-11-28 18:43:04 27 4
gpt4 key购买 nike

enter image description here

Controller 代码:

function usersView() {
var directive = {
templateUrl : "users/users.html",
restrict : "E",
replace : true,
bindToController : true,
controller : UsersCtrl,
controllerAs : 'usrs',
link : link,
scope : {}
};
return directive;
function link(scope, element, attrs) {}
}

//....

initUsersDirect();

function initUsersDirect() {
ApiFactory.getUsers().success(function(data) {
vm.usersList = data.users;
displayUsersList();
console.log('vm.usersList',vm.usersList);
});
}

function displayUsersList() {
vm.usersLoaded = true;
}

这是 usersList 中的 1 个用户对象的样子:

{
active: 1
firstname: "Alexander"
id: 1345324526
lastname: "Finkle"
role_id: 4
session: Object
username: "stackoverflow@gmail.com"
}

标记:

<tbody>
<tr ng-repeat="{ u in usrs.usersList track by u.id }">
<td class="td-name">{ u.firstname } { u.lastname }</td>
<td class="sort-email">{ u.username }</td>
<td class="sort-login">{ u.session.formatted_date }</td>
<td class="sort-role">{ u.role_id }</td>
<td><button class="btn-green-sm">Remove</button></td>
</tr>
<tr>
<td>{{usrs.usersList}}</td>
</tr>
</tbody>

知道为什么我会收到此错误吗? <强> Error: ngRepeat:iidexpInvalid Identifier

最佳答案

标记应该是:

<tbody>
<tr ng-repeat="u in usrs.usersList track by u.id">
<td class="td-name">{{ u.firstname }} {{ u.lastname }}</td>
<td class="sort-email">{{ u.username }}</td>
<td class="sort-login">{{ u.session.formatted_date }}</td>
<td class="sort-role">{{ u.role_id }}</td>
<td><button class="btn-green-sm">Remove</button></td>
</tr>
<tr>
<td>{{usrs.usersList}}</td>
</tr>
</tbody>

关于javascript - 出现 ngRepeat 错误(错误 : ngRepeat:iidexp Invalid Identifier),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35832871/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com