Is there a way to dynamically add generated names in nested ng-repeat loops? For example:
<div ng-repeat="x in JSONfile">
<div ng-repeat="i in x.name">
<span><a ng-href="{{i.link}}">{{i.name}}</a></span>
</div>
</div>
The JSONfile returns some names,
x.name is dynamically generated from the mentioned JSONfile, and it should be used as plain text like "NAME". If I add 'NAME' instead of i.name, the JSON file is loaded, but I want it to automatically load because I don't know which name will come first.
i.name currently returns each character separately (n, a, m, e) instead of "NAME" as expected...
So my question is, can Angular be told to treat this dynamically generated value as I typed it?
If I use ng-repeat="i in Tom"
, it will return the json data, but with x.name
it doesn't work.
Thanks!
EDIT (added json):
var brojVijesti = [];
$scope.JSONfile = brojVijesti;
// LNG Json
$http.get("/LEADERBOARDv2/jsons/LNG.php").then(function(response) {
var LNG = response.data.LNG;
$scope.LNG = LNG;
$scope.LNGbroj = LNG.length;
brojVijesti.push({"name":"LNG", "number":LNG.length});
});
// DT JSON
$http.get("/LEADERBOARDv2/jsons/DT.php").then(function (response) {
var DT = response.data.DT;
$scope.DT = DT;
$scope.DTbroj = DT.length;
brojVijesti.push({"name": "DT", "number": DT.length});
});