V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ghaytu
V2EX  ›  Angular

ionic AngularJS $http 怎么解释结构。

  •  
  •   ghaytu · 2018-09-06 10:21:10 +08:00 · 3430 次点击
    这是一个创建于 2030 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ( 1 ) ionic 里的 angular 的版本
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",



    ( 2 ) home.ts 文件里的代码:

    import { Component } from '@angular/core';
    import {HttpClient} from '@angular/common/http';


    @Component({
    selector: 'page-home',
    templateUrl: 'home.html'
    })
    export class HomePage {
    constructor(private httpService: HttpClient){
    this.getRequestContact()
    }

    // 本地 json 文件请求
    getRequestContact(){
    this.httpService.get("assets/sqlite/user.json").subscribe(
    res=>{
    //成功
    console.log(res)
    },error=>{
    //失败
    console.error(error)
    }
    )
    return this.httpService.get("assets/sqlite/user.json")
    }
    }
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3147 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 12:37 · PVG 20:37 · LAX 05:37 · JFK 08:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.