Appending Data To Json-ld Using Angularjs
I am newbie in angularjs and I started on the project to learn more about this framework. I make an application that puts data in a json-ld.my app can add data to the json-ld but w
Solution 1:
I think this is what you are looking for. Fiddle
What I changed in your code :
I use
ng-changeinstead of$watch. Different between them : ReferenceI create a
changeKeyValuemethod to extract key value from$scope.volatileand append it to your@graphwhen any changes happen toinputfor (var key in $scope.volatile) { if ($scope.volatile.hasOwnProperty(key)) { $scope.output["@graph"][0]["schema:" + key] = $scope.volatile[key]; } }Basically it just loop through the object, extract key-value and append it to your
output. Hope it helps.
Post a Comment for "Appending Data To Json-ld Using Angularjs"