# Use service to share data between list with $http JSON request

**URL:** <https://forum.ionicframework.com/t/use-service-to-share-data-between-list-with-http-json-request/7599>\
**Category:** ionic-v1\
**Created:** [August 3, 2014, 10:01am UTC](https://forum.ionicframework.com/t/use-service-to-share-data-between-list-with-http-json-request/7599 "2014-08-03T10:01:25Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [November 21, 2014, 2:36pm UTC](https://forum.ionicframework.com/t/use-service-to-share-data-between-list-with-http-json-request/7599/21 "2014-11-21T14:36:27Z")

</div>

Thank you, maybe i should write a book:  
Programming concepts in the world of astrophysics ^^

---

<div class="post-metadata">

**Author:** ![ujjal](https://avatars.discourse-cdn.com/v4/letter/u/d9b06d/32.png) [@ujjal](https://forum.ionicframework.com/u/ujjal)\
**Post date:** [August 24, 2015, 6:15am UTC](https://forum.ionicframework.com/t/use-service-to-share-data-between-list-with-http-json-request/7599/22 "2015-08-24T06:15:15Z")

</div>

I has a json file but it not showing in exact html format, showing only the json data! I need the docode to HTML, Please help me:

here is json file:  
[http://addaonline.in/json-page-content/?id=69](http://addaonline.in/json-page-content/?id=69)

My HTML:

ng-bind-html=“names”

My script:

.controller(‘PlaylistsCtrl’, function($scope, $ionicModal, $timeout, $ionicSlideBoxDelegate, $ionicHistory, $http, $sce, $sanitize) {  
$scope.getData = function() {  
$http.get(“[http://addaonline.in/json-page-content/?id=544](http://addaonline.in/json-page-content/?id=544)”)

```
	.success(function (response) {	$scope.names = $sce.trustAsHtml(response.content);
		return $sce.trustAsHtml(response.content);

	})
}

```

});

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [August 24, 2015, 6:28am UTC](https://forum.ionicframework.com/t/use-service-to-share-data-between-list-with-http-json-request/7599/23 "2015-08-24T06:28:31Z")

</div>

you have to decode the special html entities on your own.  
look at this plunker: [http://plnkr.co/edit/9iNnRC7AxFptnQZLPtYR?p=preview](http://plnkr.co/edit/9iNnRC7AxFptnQZLPtYR?p=preview)

add your html content with ng-bind-html to your dom:

```
ng-bind-html="yourScopeVariableWithContent"

```

use $sce-Service in your controller, to be allowed to print this html without stripping unwanted content:

```
app.controller("htmlChar", ["$scope", "$sce", function($scope, $sce) {
    $scope.yourScopeVariableWithContent = $sce.trustAsHtml("&copy; Acme");
}]);
```

---

<div class="post-metadata">

**Author:** ![ujjal](https://avatars.discourse-cdn.com/v4/letter/u/d9b06d/32.png) [@ujjal](https://forum.ionicframework.com/u/ujjal)\
**Post date:** [August 24, 2015, 7:42am UTC](https://forum.ionicframework.com/t/use-service-to-share-data-between-list-with-http-json-request/7599/24 "2015-08-24T07:42:27Z")

</div>

I have already do that!!

[Previous page](https://forum.ionicframework.com/t/use-service-to-share-data-between-list-with-http-json-request/7599.md?page=1)
