ngc-pagination
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -88,3 +88,3 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | ||
this.paginationEvents.emit({goTo: temp_current_page, e: e}); | ||
this.paginationEvents.emit({goTo: temp_current_page, event: e}); | ||
} | ||
@@ -91,0 +91,0 @@ |
{ | ||
"name": "ngc-pagination", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Simple pagination for Angular v2+", | ||
"scripts": { | ||
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ", | ||
"lite": "lite-server", | ||
"start": "tsc", | ||
"tsc": "tsc", | ||
@@ -30,8 +29,8 @@ "tsc:w": "tsc -w", | ||
"rxjs": "^5.4.2", | ||
"typescript": "^2.4.1", | ||
"zone.js": "^0.6.23" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^8.0.7" | ||
"@types/node": "^8.0.7", | ||
"typescript": "^2.4.1" | ||
} | ||
} |
@@ -5,3 +5,2 @@ # ngc-pagination | ||
## Installation | ||
@@ -19,3 +18,3 @@ | ||
Finally, you can use ngc-pagination in your Angular project. | ||
Finally, you can use `ngc-pagination` in your Angular project. | ||
@@ -54,3 +53,2 @@ ```ts | ||
1 - Configure the pagination | ||
@@ -111,2 +109,6 @@ | ||
<!-- | ||
Note the `#pagination` template variable above is used in the html below to get the component reference. | ||
you can change to any name. | ||
@@ -165,6 +167,6 @@ WARNING, I'm using the Angular Material buttons with md-button directive and <md-icon> to | ||
![](http://g.recordit.co/RDtZOmZ6kE.gif) | ||
![](http://g.recordit.co/rH0P2bdttK.gif) | ||
Cool! With your `BehaviorSubject` you can emit events and the `ngu-pagination` will react the property changes. | ||
Cool! With your `BehaviorSubject` you can emit events and the `ngc-pagination` will react the property changes. | ||
@@ -176,3 +178,3 @@ If you need change the currentPage | ||
this.paginationConfig.next({ | ||
...this.paginationConfig.getValue(), // with this you get the active properties like totalItens, range... | ||
...this.paginationConfig.getValue(), // with this you're reusing the active properties like totalItens, range... | ||
currentPage: event.goTo // you only change the currentPage property | ||
@@ -187,12 +189,19 @@ }) | ||
this.paginationConfig.next({ | ||
...this.paginationConfig.getValue(), | ||
range: 5 | ||
...this.paginationConfig.getValue(), //reusing the values... | ||
range: 5 // change only range property | ||
}) | ||
``` | ||
If change_after property is true you can update the view after 2s 'simulating a request' | ||
If `change_after` property is `true` you can update the view after 2s 'simulating a request' | ||
```Typescript | ||
createPagination() { | ||
this.paginationConfig = new BehaviorSubject({ | ||
totalItens: 300, | ||
change_after: true | ||
}); | ||
} | ||
// passing (paginationEvents)="events($event)" to listener ngc-pagination events | ||
events(event) { | ||
@@ -202,3 +211,3 @@ // simulate request | ||
// update the currentPage UI when only the request is back. | ||
// update the currentPage UI only when the 'simulate request is back' after 2s | ||
this.paginationConfig.next({ | ||
@@ -208,4 +217,9 @@ ...this.paginationConfig.getValue(), | ||
}) | ||
},2000); | ||
} | ||
``` | ||
See the behavior below when that code run: | ||
![](http://g.recordit.co/69wMYPL8qj.gif) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13884
8
216
2
- Removedtypescript@^2.4.1
- Removedtypescript@2.9.2(transitive)