Skip to content

Commit e0ef895

Browse files
committed
chore(angular2): Angular2 support
Added support for angular2
1 parent 1c27bce commit e0ef895

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# x-ng4-http-interceptor
1+
# x-ng2-http-interceptor
22

3-
[![Travis branch](https://img.shields.io/travis/1tontech/ngx-http-interceptor/angular4.svg?style=flat-square)]( https://img.shields.io/travis/1tontech/ngx-http-interceptor/angular4.svg)
4-
[![version](https://img.shields.io/npm/v/x-ng4-http-interceptor.svg?style=flat-square)](http://npm.im/x-ng4-http-interceptor)
5-
[![downloads](https://img.shields.io/npm/dm/x-ng4-http-interceptor.svg?style=flat-square)](http://npm-stat.com/charts.html?package=x-ng4-http-interceptor)
6-
[![MIT License](https://img.shields.io/npm/l/x-ng4-http-interceptor.svg?style=flat-square)](http://opensource.org/licenses/MIT)
3+
[![Travis branch](https://img.shields.io/travis/1tontech/ngx-http-interceptor/angular2.svg?style=flat-square)](https://img.shields.io/travis/1tontech/ngx-http-interceptor/angular2.svg)
4+
[![version](https://img.shields.io/npm/v/x-ng2-http-interceptor.svg?style=flat-square)](http://npm.im/x-ng2-http-interceptor)
5+
[![downloads](https://img.shields.io/npm/dm/x-ng2-http-interceptor.svg?style=flat-square)](http://npm-stat.com/charts.html?package=x-ng2-http-interceptor)
6+
[![MIT License](https://img.shields.io/npm/l/x-ng2-http-interceptor.svg?style=flat-square)](http://opensource.org/licenses/MIT)
77
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
88

9-
This package adds the intercepting capabilities to `http` module of Latest version of Angular, by extending the @angular/http class. For concept behind Interceptor, take a look at the [wiki](https://github.com/1tontech/x-ng4-http-interceptor/wiki/Concept)
9+
This package adds the intercepting capabilities to `http` module of Latest version of Angular, by extending the @angular/http class. For concept behind Interceptor, take a look at the [wiki](https://github.com/1tontech/x-ng2-http-interceptor/wiki/Concept)
1010

1111
# Installation
1212

1313
To install, just run in your angular project:
1414

1515
```
16-
npm install x-ng4-http-interceptor --save
16+
npm install x-ng2-http-interceptor --save
1717
```
1818

1919
And it should be importable with webpack out of the box
@@ -25,7 +25,7 @@ Interceptors are registered when the service is created (to avoid any race-condi
2525
```ts
2626
import { XHRBackend, RequestOptions } from '@angular/http';
2727

28-
import { InterceptorService } from 'x-ng4-http-interceptor';
28+
import { InterceptorService } from 'x-ng2-http-interceptor';
2929

3030
export function interceptorFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions) {
3131
let service = new InterceptorService(xhrBackend, requestOptions);
@@ -56,7 +56,7 @@ export function interceptorFactory(xhrBackend: XHRBackend, requestOptions: Reque
5656
Once we have it set up, we can use it in our Controllers as if we were using the default Angular `Http` service:
5757
```ts
5858
import { Component } from '@angular/core';
59-
import { InterceptorService } from 'x-ng4-http-interceptor';
59+
import { InterceptorService } from 'x-ng2-http-interceptor';
6060

6161
@Component({
6262
selector: 'my-component',
@@ -154,7 +154,7 @@ export interface Interceptor {
154154
One that will get the request that's about to be sent to the server, and another that will get the response that the server just sent. For that, we just need to create a new class that implements Interceptor:
155155

156156
```ts
157-
import { Interceptor, InterceptorRequest, InterceptorResponseWrapper } from 'x-ng4-http-interceptor';
157+
import { Interceptor, InterceptorRequest, InterceptorResponseWrapper } from 'x-ng2-http-interceptor';
158158

159159
export class ServerURLInterceptor implements Interceptor {
160160
beforeRequest(request: InterceptorRequest): Observable<InterceptorRequest> | InterceptorRequest | void {
@@ -222,7 +222,7 @@ If you are using the `provideInterceptorService` option (without AoT Compiler su
222222

223223
If our `ServerURLInterceptor` were a Service, we would have a module declaration like:
224224
```ts
225-
import { InterceptorService } from 'x-ng4-http-interceptor';
225+
import { InterceptorService } from 'x-ng2-http-interceptor';
226226
import { ServerURLInterceptor } from './services/serverURLInterceptor';
227227
import { XHRBackend, RequestOptions } from '@angular/http';
228228

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "x-ng4-http-interceptor",
2+
"name": "x-ng2-http-interceptor",
33
"version": "0.0.0-development",
44
"description": "Adds interception capability around angular http api",
55
"keywords": [
@@ -33,15 +33,15 @@
3333
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
3434
},
3535
"peerDependencies": {
36-
"@angular/core": ">=4.0.0-beta.1 <5",
37-
"@angular/http": ">=4.0.0-beta.1 <5",
36+
"@angular/core": "^2.0.0",
37+
"@angular/http": "^2.0.0",
3838
"rxjs": "^5.0.0"
3939
},
4040
"devDependencies": {
41-
"@angular/common": ">=4.0.0-beta.1 <5",
42-
"@angular/core": ">=4.0.0-beta.1 <5",
43-
"@angular/http": ">=4.0.0-beta.1 <5",
44-
"@angular/platform-browser": ">=4.0.0-beta.1 <5",
41+
"@angular/common": "^2.0.0",
42+
"@angular/core": "^2.0.0",
43+
"@angular/http": "^2.0.0",
44+
"@angular/platform-browser": "^2.0.0",
4545
"commitizen": "^2.9.5",
4646
"cz-conventional-changelog": "^1.2.0",
4747
"eslint": "^3.14.0",
@@ -65,6 +65,6 @@
6565
"tag": "dev"
6666
},
6767
"release": {
68-
"branch": "angular4"
68+
"branch": "angular2"
6969
}
7070
}

0 commit comments

Comments
 (0)