Need help with getting data from a web server

Hi Iconic members,

I’m trying to receive data from a web host in a json file into my application. I’ve successfully was able to load one message into my application but it just kept repeating itself. I have adjusted my code to $scope.newposts but i’m having no luck and it’s now not even receiving any json data. Could somebody could have a quick look? Thank you.


<ion-view view-title="Announcements">
        <ion-content ng-controller="Controller">
          <ion-refresher on-refresh="doRefresh()">

            <ion-item ng-repeat="item in items" ng-click="getData()">

            <div class="list card">
              <div class="item item-divider">{{item.announcement_name}} - {{}}</div>
              <div class="item item-body">

My Javascript:

angular.module('ionicApp', ['ionic', 'ngResource'])

.factory('Post', function($resource) {
  return $resource('/api/post/:id');

.controller('Controller', function($scope, $http, Post) {
  $scope.items = [1,2,3];
    $scope.doRefresh = function() {
            .success(function(data) {
                $scope.posts = data.announcement_name;
                $scope.posts =;
                $scope.posts = data.message;
            .finally(function() {
           // Stop the ion-refresher from spinning

      // Our form data for creating a new post with ng-model
  $scope.postData = {};
  $scope.newPost = function() {
    var post = new Post($scope.postData);

I’m not clear what you’re trying to do. Seems that always returns the same response, so what’s the point of refreshing? Also, you’re repeating ion-item for item in items, but $scope.items = [1,2,3] so that will never change either.

I will be adding more JSON tags in the future that’s why i have added $Scope.items = [1,2,3]