Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Angular UI to work

I've just installed Angular UI and I'm having trouble to make it work. Here are the stepts I followed:

index.html (Angular v1.0.1, AngularUI v0.2.1)

<script src="scripts/vendor/angular.js"></script>
<script src="scripts/vendor/jquery-1.7.2.js"></script>
<script src="scripts/vendor/jquery-ui-1.8.18.js"></script>
<script src="scripts/vendor/bootstrap.js"></script>
<script src="scripts/vendor/angular-ui.js"></script>

app.js

var publicApp = angular.module('publicApp', ['ngResource', 'ui'])

my html

<input name="dateField" class="datepicker" value="Click Here for Datepicker" ui-date>

And I get this error:

TypeError: Object [[object HTMLInputElement]] has no method 'datepicker'

Using the JS console in chrome this works:

$('.datepicker').datepicker()

What am I doing wrong?

like image 961
martinpaulucci Avatar asked Oct 10 '12 15:10

martinpaulucci


People also ask

How do I start AngularJS in Visual Studio?

Setup AngularJS Project in Visual Studio First, create new project by clicking on New Project link on start page. This will open New Project dialog box, as shown below. Select Web in the left pane and ASP.NET Web Application in the middle pane and then click OK.

Is Angular still relevant 2022?

To date, Angular is one of the most popular JavaScript frameworks in the market. It occupies a fifth place among the top 10 most used web frameworks among developers worldwide, as of 2022, with 20.39% of web developers using this framework.


1 Answers

If I'm not mistaken you need to include jQuery before AngularJS / angular-ui files. Here is the jsFiddle with the angular-ui date picker working: http://jsfiddle.net/pkozlowski_opensource/aGpNf/6/

like image 174
pkozlowski.opensource Avatar answered Sep 22 '22 02:09

pkozlowski.opensource