I'm failing to get Angular UI Select2 module to work. Simplest example I could think of is below, derived from AngularJS tutorial.
Directions on Github project (https://github.com/angular-ui/ui-select2) state, that I only need to include jQuery, Angular and Angular UI's select2.js. But then I get only errors: TypeError: Object [object Object] has no method 'select2'
Including Select2 there is no errors, but I get select tag's placeholder text as a link, then two empty text input fields a regular select dropdown. When I choose something in select dropdown, it's value replaces the placeholder text. Clicking the link empties the page, so does trying to input something to text boxes.
I have tested with multiple browsers and platforms, using Yeoman's generator-angular as a base. I tried a much older version of Angular UI's select2.js, but the behaviour did not change. Searching did not turn up anything relevant, and working examples I found are prior to Angular UI's breakup into modules.
What I am doing wrong or is this a bug?
html:
<!doctype html>
<html ng-app="anguish">
<head>
<script type="text/javascript" src="components/jquery/jquery.js"></script>
<script src="components/angular/angular.js"></script>
<script type="text/javascript" src="components/select2/select2.js"></script>
<script type="text/javascript" src="components/angular-ui-select2/src/select2.js"></script>
<script type="text/javascript" src="foo.js"></script>
</head>
<body>
<div>
<select ui-select2 ng-model="select2" data-placeholder="Pick a number">
<option value=""></option>
<option value="one">First</option>
<option value="two">Second</option>
<option value="three">Third</option>
</select>
</div>
</body>
</html>
foo.js:
'use strict';
angular.module('anguish', ['ui.select2'])
.controller('MainCtrl', function ($scope) {
$scope.select2 = null;
$scope.select2Options = {
allowClear:true
};
});