Created
February 5, 2015 20:21
-
-
Save MarZab/6b8cda742768b9915146 to your computer and use it in GitHub Desktop.
angular-schema-form + ngStrap Select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
form: [ | |
{ | |
"key": "wizzard", | |
"type": "strap-select" | |
}, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// schemaForm ngStrap Select | |
angular.module('schemaForm') | |
.config(function (schemaFormProvider, schemaFormDecoratorsProvider) { | |
//Add to the bootstrap directive | |
schemaFormDecoratorsProvider.addMapping( | |
'bootstrapDecorator', | |
'strap-select', | |
'directives/decorators/ngStrap/select.html' | |
); | |
}) | |
.run(function ($templateCache) { | |
$templateCache.put("directives/decorators/ngStrap/select.html", | |
"<div class=\"form-group {{form.htmlClass}}\" ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess(), \'has-feedback\': form.feedback !== false}\">" + | |
"<label class=\"control-label\" ng-show=\"showTitle()\">{{form.title}}</label>" + | |
"<br/><button name=\"{{form.key.slice(-1)[0]}}\" data-placeholder=\"{{form.placeholder}}\" data-animation=\"am-flip-x\" ng-model-options=\"form.ngModelOptions\" type=\"button\" class=\"btn btn-default\" ng-model=\"$$value$$\" ng-disabled=\"form.readonly\" data-html=\"1\" data-multiple=\"1\" sf-changed=\"form\" schema-validate=\"form\" ng-options=\"item.value as item.name for item in form.titleMap\" bs-select></button>" + | |
"<div class=\"help-block\" ng-show=\"(hasError() && errorMessage(schemaError())) || form.description\" ng-bind-html=\"(hasError() && errorMessage(schemaError())) || form.description\"></div>" + | |
"</div>"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schema: { | |
type: 'object', | |
properties: { | |
wizzard: { | |
"type": "array", | |
"items": { | |
"type": "string", | |
"enum": ['Something','Blah','Blaah'] | |
} | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment