0

Iam fetching data from database in a JSON format using web services. Now i need to present the json format into normal string in the view part of my AngularJS.

This my HTML file index.html

<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
    <script src="./hello.js"></script>
</head>
<body ng-controller="Hello">
    <div ng-repeat="greeting in greetings">
        <p>The ID is {{greeting.userId}}</p>
        <p>The content is {{greeting.userName}}</p>
    </div>
</body>

`

This is my java Script file hello.js

function Hello($scope, $http) {
$http.get('http://localhost:8080/RESTJerseyExample/rest/restfultest/GetCarValues').
    success(function(data) {
        $scope.greetings = data;
    });
}`
kds
  • 28,155
  • 9
  • 38
  • 55
Inr
  • 1
  • 4

1 Answers1

0

you can use JSON.stringify(object)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

Rkn
  • 122
  • 2
  • 11