2013-06-25 01:41:59 +02:00
|
|
|
|
'use strict';
|
2013-04-11 03:24:34 +02:00
|
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
|
define(function () {
|
2013-02-14 03:28:56 +01:00
|
|
|
|
|
2013-02-16 00:38:53 +01:00
|
|
|
|
$.fn.autoComplete = function (resource) {
|
2013-02-14 03:28:56 +01:00
|
|
|
|
$(this).typeahead({
|
2013-03-30 00:28:58 +01:00
|
|
|
|
source : function (filter, callback) {
|
2013-02-14 03:28:56 +01:00
|
|
|
|
$.ajax({
|
2013-06-25 01:41:59 +02:00
|
|
|
|
url : window.ApiRoot + resource,
|
2013-06-22 08:24:24 +02:00
|
|
|
|
dataType: 'json',
|
|
|
|
|
type : 'GET',
|
2013-03-30 00:28:58 +01:00
|
|
|
|
data : { query: filter },
|
|
|
|
|
success : function (data) {
|
2013-02-16 00:38:53 +01:00
|
|
|
|
callback(data);
|
2013-02-14 03:28:56 +01:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2013-05-20 22:30:23 +02:00
|
|
|
|
minLength: 3,
|
2013-06-25 01:41:59 +02:00
|
|
|
|
items : 20
|
2013-02-14 03:28:56 +01:00
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|