From 3bbd1aab0ea85edc26c7e2fea21a9ae36abea7e3 Mon Sep 17 00:00:00 2001 From: Vladimir Kalmykov Date: Wed, 30 Mar 2016 12:47:35 +0300 Subject: [PATCH] Support angular without jquery There are cases where angular is used without jquery (with jqlite). If so then executing 'element.selectize()' will throw error that selectize is undefined. To fix that we should to check jquery in element prototype and re-initialize element with jQuery on fail. --- dist/angular-selectize.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/angular-selectize.js b/dist/angular-selectize.js index a009975..555e14b 100755 --- a/dist/angular-selectize.js +++ b/dist/angular-selectize.js @@ -93,8 +93,8 @@ angular.module('selectize', []).value('selectizeConfig', {}).directive("selectiz scope.$watch('ngModel', setSelectizeValue); scope.$watch('ngDisabled', toggle); }; - - element.selectize(settings); + // we must to check for library in element prototype, if not - we should to append it + (element.jquery?element:jQuery(element)).selectize(settings); element.on('$destroy', function() { if (selectize) {