I am using swagger version 3 and with angular js. I have integrated swagger editor with angular js. Now i am stuck in getting the data that is displayed in the swagger editor and then pass to the server. below is my code:- Html code:-
<div id="swagger-editor-container" class="swagger-ui-wrap" ng-model="textVal">
controller:-
$scope.submit = function(obj){
console.log("value of textarea");
console.log(obj);
console.log($scope.textVal);
$scope.status = "Updating";
$scope.renderJson = false;
UploadFileService.uploadToS3(angular.toJson(obj))
.then(function(res){
console.log(res);
getData();
},
function(err){
console.log(err);
})
}
I cant able to get the data from swagger editor it is showing "undefined" in the console.log. Any way to get the data from swagger editor
We can retrieve data from local storage, swagger editor is storing in the localstorage. so you can get the data by using following code in angular js:-
let swaggerEditorData = window.localStorage.getItem('swagger-editor-content');
2.) Alternative way is using the inbuilt function:-
ui.specSelectors.specStr();