diff --git a/angular-schema-form-dynamic-select.js b/angular-schema-form-dynamic-select.js index 8762a9d..07003f2 100644 --- a/angular-schema-form-dynamic-select.js +++ b/angular-schema-form-dynamic-select.js @@ -9,7 +9,7 @@ }(this, function(schemaForm) { angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/strap/strapmultiselect.html","
\n \n\n
\n \n {{ (hasError() && errorMessage(schemaError())) || form.description}}\n
\n
\n"); $templateCache.put("directives/decorators/bootstrap/strap/strapselect.html","
\n \n\n
\n \n \n {{ (hasError() && errorMessage(schemaError())) || form.description}} \n
\n
\n\n");}]); -angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/uiselect/uiselect.html","
\n \n\n
\n \n \n {{select_model.selected.name}}\n \n \n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\'))+ \'\'\">\n
\n
\n
\n \n \n {{select_model.selected.name}} \n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\n \n \n \n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\n
\n \n \n\n \n\n \n \n {{select_model.selected.name}} \n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\n \n \n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\n
\n \n \n\n \n \n\n
\n \n"); +angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/uiselect/uiselect.html","
\n \n\n
\n \n \n {{select_model.selected.name}}\n \n \n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\'))+ \'\'\">\n
\n
\n
\n \n \n {{select_model.selected.name}} \n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\n \n \n \n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\n
\n \n \n\n \n\n \n \n {{select_model.selected.name}} \n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\n \n \n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\n
\n \n \n\n \n \n\n
\n \n\n"); $templateCache.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html","\n
\n \n
\n \n {{$item.name}}\n \n
\n
\n
\n \n
\n
\n
");}]); angular.module('schemaForm').config( ['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider', @@ -152,6 +152,8 @@ angular.module('schemaForm').controller('dynamicSelectController', ['$scope', '$ $scope.form.options = {}; } + $scope.select_model = {}; + console.log("Setting options." + $scope.form.options.toString()); $scope.form.options.scope = $scope; @@ -192,9 +194,9 @@ angular.module('schemaForm').controller('dynamicSelectController', ['$scope', '$ if(typeof newOptions.map.nameProperty != 'string'){ //loop through the object/array for (var i in newOptions.map.nameProperty) { - current_row["name"] += current_row[newOptions .map.nameProperty[i]]; + current_row["name"] += current_row[newOptions .map.nameProperty[i]]; if(i != final){current_row["name"] += separator}; - } + } } else{ //if it is a string diff --git a/angular-schema-form-dynamic-select.min.js b/angular-schema-form-dynamic-select.min.js index 1cc793b..087f96d 100644 --- a/angular-schema-form-dynamic-select.min.js +++ b/angular-schema-form-dynamic-select.min.js @@ -1 +1 @@ -!function(e,t){"function"==typeof define&&define.amd?define(["angular-schema-form"],t):"object"==typeof exports?module.exports=t(require("angular-schema-form")):e.angularSchemaFormDynamicSelect=t(e.schemaForm)}(this,function(e){return angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/strap/uiselectmultiple.html",'
{{$item.name}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/uiselect/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html",'
{{$item.name}}
')}]),angular.module("schemaForm").config(["schemaFormProvider","schemaFormDecoratorsProvider","sfPathProvider",function(e,t,l){var o=function(t,o,s){if("string"===o.type&&"enum"in o){var a=e.stdFormObj(t,o,s);return a.key=s.path,a.type="strapselect",s.lookup[l.stringify(s.path)]=a,a}};e.defaults.string.unshift(o),t.addMapping("bootstrapDecorator","strapselect","directives/decorators/bootstrap/strap/strapselect.html"),t.addMapping("bootstrapDecorator","strapmultiselect","directives/decorators/bootstrap/strap/strapmultiselect.html"),t.addMapping("bootstrapDecorator","strapselectdynamic","directives/decorators/bootstrap/strap/strapselect.html"),t.addMapping("bootstrapDecorator","strapmultiselectdynamic","directives/decorators/bootstrap/strap/strapmultiselect.html"),t.addMapping("bootstrapDecorator","uiselect","directives/decorators/bootstrap/uiselect/uiselect.html"),t.addMapping("bootstrapDecorator","uiselectmultiple","directives/decorators/bootstrap/uiselect/uiselectmultiple.html")}]).directive("toggleSingleModel",function(){return{require:"ngModel",restrict:"A",scope:{},replace:!0,controller:["$scope",function(e){e.$parent.$watch("select_model.selected",function(){void 0!=e.$parent.select_model.selected&&(e.$parent.insideModel=e.$parent.select_model.selected.value,e.$parent.ngModel.$setViewValue(e.$parent.select_model.selected.value))})}]}}).directive("multipleOn",function(){return{link:function(e,t,l){e.$watch(function(){return t.attr("multiple-on")},function(e){if("true"==e){var l=angular.element(t).scope().$$childTail;l.$isMultiple=!0,l.options.multiple=!0,l.$select.$element.addClass("select-multiple")}else angular.element(t).scope().$$childTail.$isMultiple=!1})}}}).filter("whereMulti",function(){return function(e,t,l){var o=[];return angular.isArray(l)&&void 0!==e?l.forEach(function(l){for(var s=0;s-1?l.splice(l.indexOf(e.value),1):l==e.value&&(console.log("Setting model of type "+t.localModelType+"to null."),l=null))}),"[object Array]"!=t.localModelType||l||(console.log("Resetting model of type "+t.localModelType+" to []."),t.$eval(o+"=[]")),console.log("----- Exiting filter for "+t.form.title+"-----"),s}}]),undefined}); +!function(e,t){"function"==typeof define&&define.amd?define(["angular-schema-form"],t):"object"==typeof exports?module.exports=t(require("angular-schema-form")):e.angularSchemaFormDynamicSelect=t(e.schemaForm)}(this,function(e){return angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/strap/uiselectmultiple.html",'
{{$item.name}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/uiselect/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html",'
{{$item.name}}
')}]),angular.module("schemaForm").config(["schemaFormProvider","schemaFormDecoratorsProvider","sfPathProvider",function(e,t,o){var l=function(t,l,s){if("string"===l.type&&"enum"in l){var a=e.stdFormObj(t,l,s);return a.key=s.path,a.type="strapselect",s.lookup[o.stringify(s.path)]=a,a}};e.defaults.string.unshift(l),t.addMapping("bootstrapDecorator","strapselect","directives/decorators/bootstrap/strap/strapselect.html"),t.addMapping("bootstrapDecorator","strapmultiselect","directives/decorators/bootstrap/strap/strapmultiselect.html"),t.addMapping("bootstrapDecorator","strapselectdynamic","directives/decorators/bootstrap/strap/strapselect.html"),t.addMapping("bootstrapDecorator","strapmultiselectdynamic","directives/decorators/bootstrap/strap/strapmultiselect.html"),t.addMapping("bootstrapDecorator","uiselect","directives/decorators/bootstrap/uiselect/uiselect.html"),t.addMapping("bootstrapDecorator","uiselectmultiple","directives/decorators/bootstrap/uiselect/uiselectmultiple.html")}]).directive("toggleSingleModel",function(){return{require:"ngModel",restrict:"A",scope:{},replace:!0,controller:["$scope",function(e){e.$parent.$watch("select_model.selected",function(){void 0!=e.$parent.select_model.selected&&(e.$parent.insideModel=e.$parent.select_model.selected.value,e.$parent.ngModel.$setViewValue(e.$parent.select_model.selected.value))})}]}}).directive("multipleOn",function(){return{link:function(e,t,o){e.$watch(function(){return t.attr("multiple-on")},function(e){if("true"==e){var o=angular.element(t).scope().$$childTail;o.$isMultiple=!0,o.options.multiple=!0,o.$select.$element.addClass("select-multiple")}else angular.element(t).scope().$$childTail.$isMultiple=!1})}}}).filter("whereMulti",function(){return function(e,t,o){var l=[];return angular.isArray(o)&&void 0!==e?o.forEach(function(o){for(var s=0;s-1?o.splice(o.indexOf(e.value),1):o==e.value&&(console.log("Setting model of type "+t.localModelType+"to null."),o=null))}),"[object Array]"!=t.localModelType||o||(console.log("Resetting model of type "+t.localModelType+" to []."),t.$eval(l+"=[]")),console.log("----- Exiting filter for "+t.form.title+"-----"),s}}]),undefined}); diff --git a/src/angular-schema-form-dynamic-select.js b/src/angular-schema-form-dynamic-select.js index 8ba877c..d2621eb 100644 --- a/src/angular-schema-form-dynamic-select.js +++ b/src/angular-schema-form-dynamic-select.js @@ -139,6 +139,8 @@ angular.module('schemaForm').controller('dynamicSelectController', ['$scope', '$ $scope.form.options = {}; } + $scope.select_model = {}; + console.log("Setting options." + $scope.form.options.toString()); $scope.form.options.scope = $scope; diff --git a/src/uiselect.html b/src/uiselect.html index 2402471..8c26e90 100644 --- a/src/uiselect.html +++ b/src/uiselect.html @@ -3,7 +3,7 @@ ng-init="insideModel=$$value$$;"> -
+
@@ -79,4 +79,4 @@ ng-show="(hasError() && errorMessage(schemaError())) || form.description" ng-bind-html="(hasError() && errorMessage(schemaError())) || form.description">
- \ No newline at end of file +