angularjs - Using the ui-select tagging with angular formly passing a function to attribute tagging -


i have created custom template angular-formly using ui-select tagging input:

formlyconfig.settype({         name: 'ui-tagging',         extends: 'select',         template: '<ui-select multiple tagging="" tagging-label="(\'new\')" ng-model="model[options.key]" theme="bootstrap" ng-required="{{to.required}}" ng-disabled="{{to.disabled}}"> <ui-select-match placeholder="{{to.placeholder}}"> {{$select.selected[to.labelprop || \'name\']}} </ui-select-match> <ui-select-choices repeat="option in to.options | filter: $select.search"> <div ng-bind-html="option | highlight: $select.search"></div> </ui-select-choices> </ui-select>',     }); 

here problem, want set function attribute tagging transform tags, example in ui-select docs.

<ui-select tagging="tagtransform" ..... 

plunker ui-select example: http://plnkr.co/edit/m1sqxuxftblqtitng1f0?p=preview

to this, you'd reference function on field options. like: options.templateoptions.tagtransform (which has shortcut: to.tagtransform). have like:

formlyconfig.settype({         name: 'ui-tagging',         extends: 'select',         template: '<ui-select multiple tagging="to.tagtransform()" tagging-label="(\'new\')" ng-model="model[options.key]" theme="bootstrap" ng-required="{{to.required}}" ng-disabled="{{to.disabled}}"> <ui-select-match placeholder="{{to.placeholder}}"> {{$select.selected[to.labelprop || \'name\']}} </ui-select-match> <ui-select-choices repeat="option in to.options | filter: $select.search"> <div ng-bind-html="option | highlight: $select.search"></div> </ui-select-choices> </ui-select>',     }); 

and field config like:

{   type: 'ui-tagging',   templateoptions: {     tagtransform: function() {}   } } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -