Skip to content

Commit

Permalink
feat: 🎸 remove deprecated @angular/http package (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
aitboudad committed Aug 27, 2019
1 parent ace3718 commit 666e341
Show file tree
Hide file tree
Showing 19 changed files with 2,617 additions and 2,555 deletions.
1 change: 0 additions & 1 deletion .config/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require("fs"),
packages = [
'core',
'http',
'http-client',
'router',
];
Expand Down
1 change: 0 additions & 1 deletion .config/publish.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const execSync = require('child_process').execSync,
packages = [
'core',
'http',
'http-client',
'router',
];
Expand Down
38 changes: 9 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
## Packages
- [@ngx-loading-bar/router](./packages/router/README.md) - Display loading bar when navigating between routes.
- [@ngx-loading-bar/http-client](./packages/http-client/README.md) - Display the progress of your `@angular/common/http` requests.
- [@ngx-loading-bar/http](./packages/http/README.md) - Display the progress of your `@angular/http` requests.
- [@ngx-loading-bar/core](./packages/core/README.md) - Core module to manage the progress bar manually.

## Demo
Expand All @@ -41,9 +40,6 @@ Table of contents
# if you use `@angular/common/http`
npm install @ngx-loading-bar/core @ngx-loading-bar/http-client --save

# if you use `@angular/http`
npm install @ngx-loading-bar/core @ngx-loading-bar/http --save

# if you use `@angular/router`
npm install @ngx-loading-bar/core @ngx-loading-bar/router --save

Expand All @@ -57,16 +53,14 @@ Table of contents
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

// for HttpClient import:
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client';

// for Http import LoadingBarHttpModule:
// import { LoadingBarHttpModule } from '@ngx-loading-bar/http';

// for Router import LoadingBarRouterModule:
// import { LoadingBarRouterModule } from '@ngx-loading-bar/router';
// for Router import:
import { LoadingBarRouterModule } from '@ngx-loading-bar/router';

// for Core import LoadingBarModule:
// import { LoadingBarModule } from '@ngx-loading-bar/core';
// for Core import:
import { LoadingBarModule } from '@ngx-loading-bar/core';

import { AppComponent } from './app';

Expand All @@ -75,19 +69,14 @@ import { AppComponent } from './app';
imports: [
...

LoadingBarHttpClientModule

// for Http use:
// LoadingBarHttpModule,
// for HttpClient use:
LoadingBarHttpClientModule,

// for Router use:
// LoadingBarRouterModule

// for HttpClient use:
// LoadingBarHttpClientModule
LoadingBarRouterModule

// for Core use:
// LoadingBarModule.forRoot()
LoadingBarModule
],
})
export class AppModule {}
Expand Down Expand Up @@ -139,15 +128,6 @@ httpClient.get('/status', {
});
```

#### http:

```ts
// ignore a particular $http GET:
http.get('/status', {
{ headers: new Headers({ ignoreLoadingBar: '' }) }
});
```

#### router:

- using the `router.navigateByUrl()` method:
Expand Down
40 changes: 0 additions & 40 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,46 +133,6 @@
}
}
},
"@ngx-loading-bar/http": {
"root": "packages/http",
"sourceRoot": "packages/http/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "packages/http/tsconfig.lib.json",
"project": "packages/http/ng-package.json"
},
"configurations": {
"production": {
"project": "packages/http/ng-package.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "packages/http/src/test.ts",
"tsConfig": "packages/http/tsconfig.spec.json",
"karmaConfig": "packages/http/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"packages/http/tsconfig.lib.json",
"packages/http/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"@ngx-loading-bar/http-client": {
"root": "packages/http-client",
"sourceRoot": "packages/http-client/src",
Expand Down
12 changes: 3 additions & 9 deletions demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1>@ngx-loading-bar/*</h1>
<ngx-loading-bar [color]="'red'"></ngx-loading-bar>
<router-outlet></router-outlet>
<p>
Automatic loading bar with zero configuration (http, http-client and router)
Automatic loading bar with zero configuration (http and router)
</p>
<img width="300" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
Expand All @@ -16,19 +16,13 @@ <h3 class="text-center">
</h3>
<ul>
<li>
Load request using `@angular/common/http`
Display loading-bar on http request
<div>
<button class="btn btn-sm btn-outline-primary" (click)="startHttpClientRequest()" type="button" name="button">Load</button>
</div>
</li>
<li>
Load request using `@angular/http`
<div>
<button class="btn btn-sm btn-outline-primary" (click)="startHttpRequest()" type="button" name="button">Load</button>
</div>
</li>
<li>
Display loading-bar on route navigation `@angular/router`
Display loading-bar on route navigation
<div>
<a class="btn btn-sm btn-outline-primary" role="button"
[routerLink]="['']"
Expand Down
14 changes: 2 additions & 12 deletions demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Component, AfterViewInit, ChangeDetectionStrategy } from '@angular/core';
import { Http } from '@angular/http';
import { HttpClient } from '@angular/common/http';
import { LoadingBarService } from '@ngx-loading-bar/core';
import { Observable, of as observableOf, interval } from 'rxjs';
import { interval } from 'rxjs';
import { map, take, delay, withLatestFrom, finalize, tap } from 'rxjs/operators';

@Component({
Expand All @@ -16,7 +15,7 @@ import { map, take, delay, withLatestFrom, finalize, tap } from 'rxjs/operators'
}
`]
})
export class AppComponent implements AfterViewInit {
export class AppComponent {
timer = 0;

delayedProgress$ = this.loader.progress$.pipe(
Expand All @@ -26,24 +25,15 @@ export class AppComponent implements AfterViewInit {
);

constructor(
private http: Http,
private httpClient: HttpClient,
public loader: LoadingBarService,
) { }

ngAfterViewInit(): void {
// this.startHttpRequest();
}

get count() {
// warning: do not use `state`, it's used here for demo purpose only
return this.loader['state'].requests || 0;
}

startHttpRequest() {
this.http.get('https://jsonplaceholder.typicode.com/users').subscribe();
}

startHttpClientRequest() {
this.httpClient.get('https://jsonplaceholder.typicode.com/users').subscribe();
}
Expand Down
2 changes: 0 additions & 2 deletions demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { RouterModule } from '@angular/router';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { LoadingBarHttpModule } from '@ngx-loading-bar/http';
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client';
import { LoadingBarRouterModule } from '@ngx-loading-bar/router';
import { AppComponent } from './app.component';
Expand All @@ -26,7 +25,6 @@ import { HelloComponent } from './hello.component';
MatProgressBarModule,
MatProgressSpinnerModule,

LoadingBarHttpModule,
LoadingBarHttpClientModule,
LoadingBarRouterModule,
],
Expand Down
Loading

0 comments on commit 666e341

Please sign in to comment.