相关疑难解决方法(0)

如何在AngularJs中使用ng-repeat进行词典?

我知道我们可以轻松地对json对象或数组使用ng-repeat,如:

<div ng-repeat="user in users"></div>
Run Code Online (Sandbox Code Playgroud)

但是我们如何才能将ng-repeat用于词典,例如:

var users = null;
users["182982"] = "{...json-object...}";
users["198784"] = "{...json-object...}";
users["119827"] = "{...json-object...}";
Run Code Online (Sandbox Code Playgroud)

我想用用户词典:

<div ng-repeat="user in users"></div>
Run Code Online (Sandbox Code Playgroud)

可能吗?.如果是,我怎么能在AngularJs中做到这一点?

我的问题示例:在C#中我们定义了如下字典:

Dictionary<key,value> dict = new Dictionary<key,value>();

//and then we can search for values, without knowing the keys
foreach(var val in dict.Values)
{
}
Run Code Online (Sandbox Code Playgroud)

是否有内置函数从c#中返回字典中的值?

json dictionary angularjs angularjs-ng-repeat

283
推荐指数
3
解决办法
17万
查看次数

标签 统计

angularjs ×1

angularjs-ng-repeat ×1

dictionary ×1

json ×1