angular-screenshot
Angular screenshot in directive for screen capture.
Check out the homepage at https://weihanchen.github.io/angular-screenshot/
Installation
Get angular screenshot from bower, npm, or git.
$npm install angular-screenshot
$bower install angular-screenshot
$git clone https://github.com/weihanchen/angular-screenshot.git
Add dependencies to the section of your index.html
Add angular-screenshot dependency to module:
angular
Options
Property | Default | Description | Sample |
---|---|---|---|
target | element.children() | Use target element with capture section. | <screenshot target="root"><screenshot> |
isOpen | false | Flag indicating that open the capture canvas. | <screenshot target="{{::'#root'}}" isOpen="appCtrl.isOpen"><screenshot> |
toolboxOptions | {"filename": "screenshot.png", "cancelText": "cancel", "downloadText": "download"} | options of screenshot toolbox | <screenshot target="root" isOpen="appCtrl.isOpen" toolbox-options="appCtrl.toolboxOptions"><screenshot> |
api | {"download": download, "cancel": cancel, "downloadFull": downloadFull, "toPng": toPng} | Expose api to interactive custom template action. | <screenshot target="root" isOpen="appCtrl.isOpen" toolbox-options="appCtrl.toolbarOptions" api="appCtrl.api"><screenshot> |
Basic Usage
Use screenshot as element or attribute, then use default template and cover children elements default
crop close<!--screenshot--> ...
Use target parameter to set screenshot section on element
... ...
'use strict'; {angular; { var self = this; selftarget1Options = filename: 'target1.png' downloadText: 'Download me' cancelText: 'Close it!' ; }}
Advanced usage
Use screenshot-toolbox
to customize your toolbox, then use expose api to interactive with directive.
close check ...
'use strict'; { angular { var self = this; selfadvanceApi; selfcancel = cancel; selfdownload = download; { if selfadvanceApi selfadvanceApi; } { if selfadvanceApi selfadvanceApi; }});
Use screenshot as element or attribute, then use expose api to download full dom content
crop close file_download <!--screenshot--> ...
'use strict'; {angular { var self = this; selffullScreenApi; selfdownloadFull = downloadFull; { if selffullScreenApi selffullScreenApi; }});
Use screenshot as element or attribute, then use expose api to send image data to backend api.
crop close sendImage
'use strict'; { angular { var self = this; selfimageApi; selfsendImage = sendImage; { if selfimageApi selfimageApi; } }};
Development scripts
npm run dev
: webpack lite server auto reload on changed.npm run build
: generate built files and minified ones.npm run watch
: watch source files and run build script.npm run release
: increase package version.
Development requirements
- nodejs ^6.0.0
Todos
- Capture with font can cause some problem, and this bug still trying fix.
RWD issue fix.- Add saveas feature.