In angularJs what is the syntax to import this into polyfills.ts?
Closed this issue · 8 comments
I've looked all over and can't find an answer to this. I'm using angular 5.
Can't you just use a <script> element?
<script src='scripts/DragDropTouch.js"></script>With Angular CLI, I think dragdroptouch would have to be an NPM package. Bernardo, would you mind if I created an NPM package for it, or has it been done already?
Once the npm package has been created, then you would install the package, and reference it in polyfills.js
I would not mind at all, that would actually be great!
Thank you for your help!
It looks like it's already been published out there:
Also a newer one:
https://www.npmjs.com/package/drag-drop-touch
In Angular (not JS) you need to add it to scripts
, inside angular.json
file architect > build > options
, e.g.:
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [
"src/DragDropTouch.js"
]
As it is a polyfill, I prefer to add it in polyfills.ts: import 'drag-drop-touch';
after npm install
ing, but I guess that's a matter of taste 😃
I'm closing this because this isn't really an angular issue: just load the polyfill in your HTML. The "OG" web stack still applies.