V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ghaytu
V2EX  ›  Angular

ionic AngularJS $http 怎么解释结构。

  •  
  •   ghaytu · Sep 6, 2018 · 4075 views
    This topic created in 2790 days ago, the information mentioned may be changed or developed.
    ( 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")
    }
    }
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1191 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 23:23 · PVG 07:23 · LAX 16:23 · JFK 19:23
    ♥ Do have faith in what you're doing.