angular formly - [fromly]: pass controller to template -
i'm trying make form button inside js, because formly directive rendered form isn't correct. decided push button , render button template button has lost access controller , validation form. have missed here?
controller.js
.controller('x', ['$log', 'api', function($log, api) { var _self = this; _self.model = {}; _self.formparts = [{ classname: 'row', fieldgroup: [ { classname: 'col-xs-3', key: 'q', type: 'select', templateoptions: { required: true, valueprop: "id", labelprop: "name", options: [ {name: '0', id: 0}, {name: '1', id: 1}, ], } }, { classname: 'col-xs-7', key: 'n', type: 'input', templateoptions: { required: true, type: 'text', placeholder: 'name' } } { classname: 'col-xs-2', templateurl: 'button.html' } ] }]; _self.save(model) { $log.info(model); }; }]);
main.html
<formly-form model="f.model" fields="f.formfields" form="formform"> </formly-form>
button.html
<button type="submit" class="btn btn-success" ng-disabled="formform.$invalid" ng-click="f.save(f.model)">save </button>
Comments
Post a Comment