Skip to content

Commit

Permalink
Merge pull request #1 from selemxmn/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
selemxmn authored Nov 25, 2018
2 parents bb94b71 + 60d2388 commit c676240
Show file tree
Hide file tree
Showing 40 changed files with 66 additions and 8,784 deletions.
59 changes: 45 additions & 14 deletions README.md
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
* ...
170 changes: 0 additions & 170 deletions angular.json

This file was deleted.

28 changes: 0 additions & 28 deletions e2e/protractor.conf.js

This file was deleted.

14 changes: 0 additions & 14 deletions e2e/src/app.e2e-spec.ts

This file was deleted.

11 changes: 0 additions & 11 deletions e2e/src/app.po.ts

This file was deleted.

13 changes: 0 additions & 13 deletions e2e/tsconfig.e2e.json

This file was deleted.

File renamed without changes.
54 changes: 5 additions & 49 deletions package.json
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": "*"
}
}
7 changes: 0 additions & 7 deletions projects/ngx-print/ng-package.json

This file was deleted.

8 changes: 0 additions & 8 deletions projects/ngx-print/package.json

This file was deleted.

Loading

0 comments on commit c676240

Please sign in to comment.