简体   繁体   English

Angular2中的http.get()函数在哪里定义?

[英]Where is the http.get() function in Angular2 defined?

I'm new to Typescript and Angular 2. 我是Typescript和Angular 2的新手。

I wanted to look at the exact implementation of http.get() , so I opened the file in ./node_modules/angular2/src/http/http.d.ts and scrolled to the get function. 我想看看http.get()的确切实现,所以我在./node_modules/angular2/src/http/http.d.ts打开了文件并滚动到get函数。 This is what I found: 这是我发现的:

    /**
     * Performs a request with `get` http method.
     */
    get(url: string, options?: RequestOptionsArgs): Observable<Response>;
    /**
     * Performs a request with `post` http method.
     */
    post(url: string, body: string, options?: RequestOptionsArgs): Observable<Response>;
    /**
....

Basically, there is no function definition. 基本上没有函数定义。 It seems like an abstract method (in Java lingo). 似乎是一种抽象方法(在Java语言中)。 I looked through the other http files, used VSCode intellisense, and couldn't find the code for the body of the function. 我浏览了其他http文件,使用了VSCode intellisense,但找不到该函数主体的代码。

Where is it and how can I find it? 在哪里,如何找到它?

It is defined here: https://github.com/angular/angular/blob/master/modules/angular2/src/http/http.ts 它在这里定义: https : //github.com/angular/angular/blob/master/modules/angular2/src/http/http.ts

What you are seeing is the TypeScript typings file. 您将看到TypeScript类型文件。 It contains the definitions, but not the implementation. 它包含定义,但不包含实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM