Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49246

HTTP GET and JSON

$
0
0

@Sas123 wrote:

Please Help
I get error massage post.data.url:1 GET http://localhost:8100/post.data.url 404 (Not Found) in when I try to call my Json.

Below is my Json Array

{“success”:true, “data”:[{“title”:“sassan”,“duration”:“5 day”,“url”:“http://mywebsite/uploads/test/phoneapp/uploads/cdv_photo_001.jpg"},{“title”:“Ahmad”,“duration”:“20day”,“url”:“http://mywebsite/uploads/cdv_photo_002.jpg”},{“title”:“Sardin”,“duration”:“49”,“url”:“http:/mywebsite/uploads/test/phoneapp/uploads/cdv_photo_003.jpg”},{“title”:“Sas”,“duration”:“59”,“url”:“http://mywebsite/uploads/test/phoneapp/uploads/cdv_photo_004.jpg”},{“title”:“Rosst”,“duration”:“50”,“url”:"http://mywebsite/uploads/test/phoneapp/uploads/newimage_647999118”}]}


and my home.ts

import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { Http } from ‘@angular/http’;
import ‘rxjs/add/operator/map’;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {

posts: any;

constructor(public navCtrl: NavController, public http: Http) {

this.http.get('http://www.mywebsite.json').map(res => res.json()).subscribe(data => {
    this.posts = data;

});

}
}

my home.html

Home Page



<ion-item *ngFor=“let post of posts”>



Please Help

Posts: 14

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 49246

Trending Articles