diff --git a/src/sortable.js b/src/sortable.js index 2687640..3a459f9 100644 --- a/src/sortable.js +++ b/src/sortable.js @@ -38,7 +38,7 @@ angular.module('ui.sortable', []) update:null }; - angular.extend(opts, uiSortableConfig); + angular.extend(opts, uiSortableConfig, scope.$eval(attrs.uiSortable)); if (!angular.element.fn || !angular.element.fn.jquery) { $log.error('ui.sortable: jQuery should be included before AngularJS!'); diff --git a/test/sortable.e2e.callbacks.spec.js b/test/sortable.e2e.callbacks.spec.js index 17577a8..491ec5a 100644 --- a/test/sortable.e2e.callbacks.spec.js +++ b/test/sortable.e2e.callbacks.spec.js @@ -190,6 +190,28 @@ describe('uiSortable', function() { }); }); + it('should call the create() callback when initialized', function() { + inject(function($compile, $rootScope) { + var element; + $rootScope.$apply(function() { + $rootScope.items = ['One', 'Two', 'Three']; + $rootScope.opts = { + create: function() { + + } + }; + spyOn($rootScope.opts, 'create'); + element = $compile('')($rootScope); + }); + + host.append(element); + + expect($rootScope.opts.create).toHaveBeenCalled(); + + $(element).remove(); + }); + }); + }); }); \ No newline at end of file