1

I use angular-json-editor. This is controller:

var TaskEditCtrl = function($scope, $http, $routeParams, Notification, Task) {
    $scope.task = Task.get({id: $routeParams.taskId});
    $scope.schema = $http.get("/static/schema/schema.json");
};

This is template:

<json-editor schema="schema" startval="task.data">

task.data is undefined and not loaded into editor. How make it?

1
  • Is $scope.task.data defined? Commented Oct 13, 2015 at 17:41

1 Answer 1

1

You need to have the directive compiled when the data is available. You can control this using ngIf

<json-editor ng-if="task" schema="schema" startval="task">

Also the $http.get returns a promise, and I assume Task does the same.

 Task.get(...).then(function(response) { $scope.task = response.data; });
 $http.get('/static/schema/schema.json').then(function(json){$scope.schema = json;});
Sign up to request clarification or add additional context in comments.

2 Comments

Ok. Other way. If add into plugin watcher, this can help resolve this problem?
Actually, angular-json-editor accepts promises for both schema and startval. hello from 2016 :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.