I am trying to get this array from a remote server which is connected to a dynamic database of course.
As far as i read from ionic forums i need to use $http function from AngularJS but i am pretty new to AngularJS and current examples seems too much complicated to me like this one.
I am trying to convert this example to Remote JSON.
HTML Part:
<ion-list>
<ion-item ng-repeat="item in items"
item="item"
href="#/item/{{item.id}}">
Person {{ item.id }} Name {{ item.name }}
</ion-item>
</ion-list>
Array Part:
var friends = [
{ id: 1, name: 'G.I. Joe' },
{ id: 2, name: 'Miss Frizzle' },
{ id: 3, name: 'Scruff McGruff' },
{ id: 4, name: 'G.I. Joe' },
{ id: 5, name: 'Miss Frizzle' },
{ id: 6, name: 'Scruff McGruff' },
{ id: 7, name: 'G.I. Joe' },
{ id: 8, name: 'Miss Frizzle' },
{ id: 9, name: 'Scruff McGruff' },
{ id: 10, name: 'G.I. Joe' },
{ id: 11, name: 'Miss Frizzle' },
{ id: 12, name: 'Scruff McGruff' },
{ id: 13, name: 'G.I. Joe' },
{ id: 14, name: 'Miss Frizzle' },
{ id: 15, name: 'Scruff McGruff' },
{ id: 16, name: 'G.I. Joe' },
{ id: 17, name: 'Miss Frizzle' },
{ id: 18, name: 'Ash Ketchum' }
];
I have tried:
1-
$scope.items = jsonp(‘http://www.garsoncepte.com/json.php’);
2-
$scope.items = $http.jsonp('http://www.garsoncepte.com/json.php');
3-
var url = "http://www.garsoncepte.com/json.php";
$scope.items = $http.jsonp(url);