Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AngularJS An Introduction to Directives Using the Link Function

Laura Henneberry
Laura Henneberry
1,808 Points

Do I need to download the jQuery UI for this to work? Without it I'm getting an error $element.datepicker == undefined

Without it I'm getting an error $element.datepicker == undefined within my link object.

2 Answers

The short answer is yes. You are almost certainly calling Jquery when you are using the $ there.

Though the longer answer is that you don't need to download Jquery, but you do need to link to it in your file. Including this: <script src="//code.jquery.com/jquery-1.11.2.min.js"></script> in your file ahead of your Javascript declaration should solve your problem. If it doesn't, post some of your code so we can see more clearly what's going on. Best luck!

Laura Henneberry
Laura Henneberry
1,808 Points

Thanks Brian,

I had to grab the jquery, jqueryUI and the css: I was getting an error without the jquery. I thought that I wouldn't need the jquery since jqueryLite is included in angularjs.

<html ng-app="treehouseCourse"> <head> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/black-tie/jquery-ui.css" /> </head> <body ng-controller="stageOneCtrl">

<script src='https://code.jquery.com/jquery-2.1.3.js'></script>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js'></script>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
<script type="text/javascript" src="app.js"></script>

</body> </html>