Sanitize input for ofn-select2

This commit is contained in:
Rohan Mitchell
2016-02-19 16:06:19 +11:00
parent 977ff7b35d
commit ae03170984
2 changed files with 4 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
angular.module("admin.indexUtils").directive "ofnSelect2", ($timeout, blankOption) ->
angular.module("admin.indexUtils").directive "ofnSelect2", ($sanitize, $timeout) ->
require: 'ngModel'
restrict: 'C'
scope:
@@ -10,6 +10,8 @@ angular.module("admin.indexUtils").directive "ofnSelect2", ($timeout, blankOptio
$timeout ->
scope.text ||= 'name'
scope.data.unshift(scope.blank) if scope.blank? && typeof scope.blank is "object"
item.name = $sanitize(item.name) for item in scope.data
element.select2
minimumResultsForSearch: scope.minSearch || 0
data: { results: scope.data, text: scope.text }

View File

@@ -1 +1 @@
angular.module("admin.indexUtils", ['ngResource', 'templates']).config ($httpProvider) ->
angular.module("admin.indexUtils", ['ngResource', 'ngSanitize', 'templates']).config ($httpProvider) ->