Clipboard.js: clipboard symfony 4 ?

Created on 20 Sep 2018  路  2Comments  路  Source: zenorocha/clipboard.js

Hello,

Can not import the JS.
I did:
npm install clipboard --save

The files are present in node_modules
Then in my app.js file I do:

import 'clipboard.min';
var clipboard = new ClipboardJS ('. CopyText');
clipboard.on ('success', function (e) {
     alert ( 'OK');
});

He says to me in console:
ReferenceError: ClipboardJS is not defined

If I go through:

All 2 comments

When importing a module with webpack, it does not create a global variable. this is how things should look like:

import ClipboardJS from 'clipboard.min';

var clipboard = new ClipboardJS ('.CopyText');

Thanks @stof for providing a solution.

Was this page helpful?
0 / 5 - 0 ratings