Question:
I am using the angularjs version for this json-editor .
Page controller:
var TaskEditCtrl = function($scope, $http, $routeParams, Notification, Task) {
// Загружаем сам объект
$scope.task = Task.get({id: $routeParams.taskId});
// Загружаем схему
$scope.schema = $http.get("/static/schema/schema.json");
};
Page template:
<json-editor schema="schema" startval="task.data">
No data is loaded in the Editor
, an empty editor opens.
How can I solve this problem (if it is not a bug in the library)?
Answer:
To solve the problem, you need to rewrite the controller code in the following way:
var TaskEditCtrl = function($scope, $http, $routeParams, Notification, Task) {
// Загружаем сам объект
$scope.task = Task.get({id: $routeParams.taskId});
// Загружаем схему
$http
.get("/static/schema/schema.json")
.then(function(res) {
$scope.schema = res;
});
};