javascript - Angular JS, JSON via extern Libary Function not storing in $scope
问题描述
Hey People i have a problem storing my JSON in the $scope. this is the Code:
var app = angular.module("mainApp",[]);
app.service("KategorienService", function() {
this.getKategorien = function() {
return Workbook.load(optionsStatus)
};
});
app.controller("KategorienCtrl", function($scope, KategorienService) {
KategorienService.getKategorien().then(res => {
$scope.Kategorien = res;
});
});
The Workbook.load() returns a Promise with a parsed JSON Object. Now i try to Copy the JSON who is already parsed into the Scope and display it via ng-repeeat like so:
<div ng-app="mainApp">
<div ng-controller="KategorienCtrl">
<p>Kategorien: </p>
<li ng-repeat="Kategorie in Kategorien" >
{{Kategorie.label + Kategorie.value}}
</li>
</div>
</div>
But nothing is show, even tho the Console shows that the $scope.Katogrien has the JSON. this is the JSON:
(2) [{…}, {…}]
0:
label: "Fusball"
value: "FUS"
_autoId: 3
_created: {$date: "2021-09-03T08:41:20.613Z"}
_deviceId: "c4IDr2tLTmG6MOQKTMfyRd"
_id: {$oid: "6131dfcbe4b055b5d3b86788"}
_lastModified: {$date: "2021-09-03T08:41:47.038Z"}
_sheet: "6131df7ae4b055b5d3b86775"
_userProfile: ""
[[Prototype]]: Object
1: {_id: {…}, value: "HAND", label: "Handball", _user: "Jayklops", _userProfile: "", …}
length: 2
pls Help best regards
解决方案
推荐阅读
- angular - Angular Material:添加新行而不刷新表
- reactjs - 如何从本地 json 中选择一个对象并将其传递给 state?
- c# - 生成一个对象(使用递归),而其他对象不是
- javascript - 无法在 wysihtml5 编辑器中获取光标位置
- xslt - 在 xml 中使用多个命名空间
- javascript - 反应:状态对象属性未更新
- mysql - 即使在 IN 子句中找不到列,也将其设为 NULL
- objective-c - 在 Swift 中访问 object-c NSDictionary 值很慢
- amazon-web-services - 有没有办法列出所有权限以及 IAM 用户可以访问哪些资源?
- node.js - 无法启动 Angular hello-world 项目 - 发生未处理的异常