-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from selemxmn/develop
Merge develop into master
- Loading branch information
Showing
40 changed files
with
66 additions
and
8,784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,58 @@ | ||
# NgxPrint | ||
|
||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.6. | ||
# ngx-print : *plug n' play Angular (2++) directive to print your stuff* | ||
This directive makes printing your HTML sections smooth and easy in your Angular application. It is inspired from the old [AngularJS ngPrint](https://github.com/gilf/ngPrint) directive, thus it is intendend to be used with the new Angular -2/4/5/6/7-... ***Enjoy ! contributions are so welcomed :)*** | ||
|
||
## Development server | ||
## Setup | ||
|
||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. | ||
**1-** In your root application folder run: | ||
```bash | ||
$ npm install ngx-print | ||
``` | ||
|
||
## Code scaffolding | ||
**2-** Once `ngx-print` is installed, you need to import the main module `NgxPrintModule` : | ||
|
||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. | ||
```js | ||
import {NgxPrintModule} from 'ngx-print'; | ||
|
||
## Build | ||
@NgModule({ | ||
... | ||
imports: [NgxPrintModule, ...], | ||
... | ||
}) | ||
export class YourAppModule { | ||
} | ||
``` | ||
|
||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. | ||
**3-** Then plug n' play with it: | ||
|
||
## Running unit tests | ||
- Assuming you want to print the following HTML section: | ||
|
||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||
```html | ||
<div> | ||
<!--Your html stuff that you want to print--> | ||
</div> | ||
<button>print</button> <!--Your relevant print button--> | ||
|
||
## Running end-to-end tests | ||
``` | ||
|
||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). | ||
- Now, what you have to do is tagging your *wanted-to-print* section by an `id` attribute, then link that `id` to a directive parameter in your button : | ||
|
||
## Further help | ||
```html | ||
<!-- | ||
1)- Add an ID here | ||
--> | ||
<div id="print-section"> | ||
<!--Your html stuff that you want to print--> | ||
</div> | ||
|
||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). | ||
<!-- | ||
2)- Add the directive name in your button (ngxPrint), | ||
3)- Affect your ID to printSectionId | ||
--> | ||
<button printSectionId="print-section" ngxPrint>print</button> | ||
|
||
``` | ||
## TODO | ||
* Disable the print button once the popped window is opened | ||
* Write tests | ||
* ... |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,8 @@ | ||
{ | ||
"name": "ng-print", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"ng": "ng", | ||
"start": "ng serve", | ||
"build": "ng build", | ||
"test": "ng test", | ||
"lint": "ng lint", | ||
"e2e": "ng e2e" | ||
}, | ||
"private": true, | ||
"dependencies": { | ||
"@angular/animations": "~7.0.0", | ||
"@angular/common": "~7.0.0", | ||
"@angular/compiler": "~7.0.0", | ||
"@angular/core": "~7.0.0", | ||
"@angular/forms": "~7.0.0", | ||
"@angular/http": "~7.0.0", | ||
"@angular/platform-browser": "~7.0.0", | ||
"@angular/platform-browser-dynamic": "~7.0.0", | ||
"@angular/router": "~7.0.0", | ||
"core-js": "^2.5.4", | ||
"rxjs": "~6.3.3", | ||
"zone.js": "~0.8.26" | ||
}, | ||
"devDependencies": { | ||
"@angular-devkit/build-angular": "~0.10.0", | ||
"@angular-devkit/build-ng-packagr": "~0.10.0", | ||
"@angular/cli": "~7.0.6", | ||
"@angular/compiler-cli": "~7.0.0", | ||
"@angular/language-service": "~7.0.0", | ||
"@types/node": "~8.9.4", | ||
"@types/jasmine": "~2.8.8", | ||
"@types/jasminewd2": "~2.0.3", | ||
"codelyzer": "~4.5.0", | ||
"jasmine-core": "~2.99.1", | ||
"jasmine-spec-reporter": "~4.2.1", | ||
"karma": "~3.0.0", | ||
"karma-chrome-launcher": "~2.2.0", | ||
"karma-coverage-istanbul-reporter": "~2.0.1", | ||
"karma-jasmine": "~1.1.2", | ||
"karma-jasmine-html-reporter": "^0.2.2", | ||
"ng-packagr": "^4.2.0", | ||
"protractor": "~5.4.0", | ||
"ts-node": "~7.0.0", | ||
"tsickle": ">=0.29.0", | ||
"tslib": "^1.9.0", | ||
"tslint": "~5.11.0", | ||
"typescript": "~3.1.6" | ||
"name": "ngx-print", | ||
"version": "1.0.0", | ||
"peerDependencies": { | ||
"@angular/common": "*", | ||
"@angular/core": "*" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.