I got a basic problem, though I don't figure out, why it's not working:
<article id="desktop">
<h3>Content: </h3>
<ul>
<li ng-repeat="x in storage">
name: {{x.name}}
</li>
</ul>
</article>
And my angular:
$scope.storage = [];
...
$scope.showDesktop = function(){
$http.get("/getDesktop").then(function(response){
for(var i = 0; i<response.data.length; i++){
$scope.storage.push({
name: response.data[i]
});
}
console.log($scope.storage);
return;
});
}
There must be an syntax error but I can't figure out where it is. I alredy looked in the documentation and copied the ng-repeat syntax, but it still doesn't work.
Console.log shows just the correct content.
My Spring controller looks like:
//Returns Desktop
@GetMapping("/getDesktop")
public ArrayList<String> getDesktop() throws Exception {
ArrayList<String> itemNames = new ArrayList<>();
if(kdxF.getLogged() && kdxF.getUser() != null) {
itemNames = kdxF.showDesktop();
}else {
throw new Exception("Not logged in!");
}
return itemNames;
}