angularjs - angular formly read-only mode for radio , multiCheckbox and checkbox -
i need display form in read-only mode , creating form based on json using angular-formly . checked link http://angular-formly.com/#/example/other/read-only-form works text input , please suggest how set read-only radio , multicheckbox , checkbox
we via jquery:
$(document).ready(function () { $('input').click(function (e) { e.preventdefault(); }); });
or if want "pretend" using "angular" this, though using jquery, , want type out whole lot more code write exact same thing(literally, run above code in jquery angular.element "alias" jquery---straight out of angular docs: https://docs.angularjs.org/api/ng/function/angular.element), can do:
angular.element(function() { angular.element('input').trigger('click')(function(e) { e.preventdefault(); }; });
this way can cool , spout off nonsense "it's bad practice run angular , jquery together" because have no clue talking , read somewhere.
this works input fields. if have buttons or datepickers buttons, etc easiest way set readonly property on model in form , set true on page want read set ng-show on buttons to: ng-show="!model.readonly"
Comments
Post a Comment