Created
October 25, 2017 08:59
-
-
Save Grytsak/f41251c1d81394308c9cfa68696e6239 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HOLY SMOKES! This one was very troublesome, but I figured it out after days of trying. | |
So, there are a lot of partial answers out there, but this should be complete. You cannot from what I have seen, include jquery-ui in your angular-cli and the index. The plugin inclusions will be overwritten and jquery as a global will be undefined. I couldn't get it to work by using just the angular-cli.json, but I did get it to work by only using index inclusion. | |
Here is what needs to be done to only use index script inclusion for jquery/jquery-ui. | |
1: Uninstall jquery and jquery-ui and remove it from the package.json | |
npm uninstall --save jquery jquery-ui | |
2: Delete the node_modules folder | |
3: Delete any references to jquery or jquery-ui in you angular-cli.json file | |
4: Rebuild the node_modules folders (double check that jquery-ui is not there, but it doesn't really matter so long as the angular-cli.json doesn't have it included. | |
npm install | |
5: include jquery, then jquery-ui in your index file. I used 2.2.4, because I don't trust 3 yet. | |
<script src="https://code.jquery.com/jquery-2.2.4.js" integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI=" crossorigin="anonymous"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> | |
6: In what ever component you want to utilize jquery or jquery plugin inject $ | |
declare var $: any; | |
$('draggable').draggable(); // WORKS! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment