json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Update $scope.model after bootstrapping angularjs module. #910

Closed chakraborty-slx closed 6 years ago

chakraborty-slx commented 7 years ago

Please see this plunker https://plnkr.co/edit/Kax2uyNC0XdnSZCQWBLo

I am trying to set the $scope.model after the bootstrap manually, as this is a usecase in which the model is read from an external file which i m emulating for the example.

Please suggest any link or post by which i can update the model with my input json .

scottux commented 6 years ago

The simple way is to just use:

$http.get('my_file.json').then(function (res) {
    $scope.model = JSON.parse(res.data);
});

https://plnkr.co/edit/Ity4ercMGQyDOiRjpi1Y?p=preview

Anthropic commented 6 years ago

@AChakraborty1982 please comment if you want to re-open or do not feel the question has been answered sufficiently.