EddyVerbruggen / nativescript-printer

:fax: Send an image or the screen contents to a physical printer
MIT License
36 stars 13 forks source link

Usage with angular, printScreen does not work without view arg #15

Open bufke opened 5 years ago

bufke commented 5 years ago

Hello, it looks like printScreen() without any view arg doesn't work in angular based projects. let view: View = frame.topmost().currentPage.content; ends up being undefined. Passing the view explicitly works but has no example. This works:

@ViewChild("foo") foo: ElementRef;
printer.printScreen({ view: this.foo.nativeElement });

I could submit a PR just updating the documentation if you'd like. If we wanted to not fix the currentPage issue, we could just note that the view arg is required when using Angular.