Open CelsoSantos opened 7 years ago
@CelsoSantos
You're right. There is no need to explicitly install ts-clipboard if you're installing ng2-clipboard. I'll update the README.md shortly.
ng2-clipboard@1.0.24 depends on angular ^2.1.2. (commit 60e98289)
I'm testing it now to see if it works.
This was one of my first attempts at an angular 2 module and the version history is quite a mess. It may be worth while for me to publish a final version of ng2-clipboard that truly uses angular 2 and then publish a ngx-clipboard package for angular 4+.
If you try the 1.0.24 version, you may have to map ng2-clipboard
in SystemJS to node_modules/ng2-clipboard/ng2-clipboard.js
.
Hi @gforceg ,
That shouldn't be too much of an issue for me. I'm trying to use the plugin with Ionic 2 and even though I don't get any errors I also don't get the copied content upon Ctrl/Cmd+C (I'm on a Mac and at least for now it really does not work).
I will try to also upgrade to Ionic 3 (which already required Angular 4) and try to get back to you on that issue (open a new one if required).
Thank you for your prompt reply.
At least on Ionic, if you don't install ts-clipboard the build will fail. I had to install ng2-clipboard AND ts-clipboard. Maybe the best approach would be to set ts-clipboard as a peerDependency rather than a dependency of the module
@CelsoSantos,
I remember having that issue myself and not understanding why ts-clipboard had to be installed as a peer for it to work if it is a peer dependency -- that must be why I included it in the readme.
ts-clipboard uses the web application clipboard api are you running your project as a native app? If so, I wonder if Ionic translates the clipboard api over. I know that the api is still experimental at this point though it has been implemented in all major browsers.
I can confirm that ng2-clipboard@1.0.24
works w/ angular 2.1.2.
I only tested it in an angular-seed project in Firefox (Fedora 25).
I can also confirm that, at least on MacOS, v1.0.24 works as intended. :)
When I talked about setting ts-clipboard as a peerDependency what I mean is removing ts-clipboard from the package.json dependencies key and placing it in the peeDependencies key. Take a look at this doc as it explains it really well: https://nodejs.org/en/blog/npm/peer-dependencies/
Best Regards and thank you for the quick replies and help :)
Guess I spoke too soon. After debugging I're realised that it's not putting the intended contents in the clipboard after all :(
Also, I'm not sure if it's related, but v1.0.24 still complains about unmet dependencies of angular 4
I understand and I'm familiar w/ peer-dependencies. It was intended to be a dependency though. I think the problems I had w/ it were more related to SystemJs.
I've decided to make a few changes: I'm going to include the ts-clipboard source code in with ng2-clipboard and compile them as a unit rather than using ts-clipboard as a separate library. This way all the user needs to do is say 'npm i ng2-clipboard' and be done with it.
I'm also going to publish ng2-clipboard to explicitly target angular >=2.0.0 and put a deprecation message pointing to a separate (to be published) package called ngx-clipboard for all future verions of angular.
Hi @gforceg ,
That would be greatly appreciated. I would be more than happy to help but I'm kinda overwhelmed with work right now and don't have the time to contribute properly.
When you have a chance, would you please let me know of it? Thank you! :)
Hello,
This plugin seems to depend on Angular ^4.0.0. Is there any version that works on Angular 2.x?
Also, there seems to be a version mismatch on install. ng2-clipboard already depends on ts-clipboard. Why should one install ts-clipboard along with ng2-clipboard?