Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from '@angular/core';
- import { IonicPage, NavController, NavParams } from 'ionic-angular';
- import { Storage } from '@ionic/storage';
- export class CreerDiscussionPage {
- discussion: Discussion;
- constructor(
- public navCtrl: NavController,
- public navParams: NavParams,
- public rfcAPI: RfcApiProvider,
- public discussionProvider: DiscussionProvider
- ) {
- this.rfcAPI = rfcAPI;
- this.discussionProvider = discussionProvider;
- this.discussion = new Discussion();
- }
- getDiscussion() {
- this.rfcAPI.getDiscussion()
- .then(data => {
- // Error raised in this place : Property 'name' does not exist on type '{}'.
- console.log(data.name);
- });
- }
- }
- // Method in the rfcApi provider
- import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
- .....
- getDiscussion() {
- return new Promise(resolve => {
- this.http.get('http://localhost:3000/api/conversation/9a19d9e944e4b105d360614572b715434a365e724beddb83a4f1464a1ea79d29')
- .subscribe(data => {
- resolve(data);
- }, err => {
- console.log(err);
- });
- });
- }
Add Comment
Please, Sign In to add comment