angular-formly

Formly update templateOptions on click of button

烈酒焚心 提交于 2021-01-29 14:39:49
问题 I'm new to formly, I want to change the templateOptions property based on value, so below is my config formlyConfig.setType({ name: 'phone', extends: 'maskedInput', defaultOptions: { templateOptions: { mask: '999-9999-9999' }, I want to change the mask to mask: '999-999-9999' on a button click, I tried to do this on onclick of button , but no change formlyConfig.setType({ name: 'phone', defaultOptions:{ templateOptions: { mask: '999-999-9999' }, } }) ; 回答1: I'm considering you're using

How to Bind a component on click of element in multiselect of angular formly Reactive forms

六眼飞鱼酱① 提交于 2021-01-05 07:39:12
问题 I have a reuquirement in which i am using a multiselect dropdwon which also has logo for each row. On click of this logo i want to load other component, like we use viewchild in template driven approach is it possible to use it in Reactive formly form component? Step 1: Open multiselect of formly element. Step 2: There is a logo in each row, on click of logo a method is called and need to load calender component in popup. Step 3 : Load contents of calendar-component.html in modal popup.

Angular material date picker format locale

随声附和 提交于 2020-01-30 11:49:05
问题 I have created an angular material date picker component to use with formly , and tried to set it to use GB for the locale so that dates are shown as 26/07/2019 . However, when typing in the date, it parses as US still, resulting in invalid date errors being shown. I have tried to include moment and the MomentDateAdapter module but have been unable to solve the issue. Here is a stackblitz I've set my providers like so: providers: [ { provide: LOCALE_ID, useValue: 'en-GB' }, { provide:

Angular material date picker format locale

只愿长相守 提交于 2020-01-30 11:48:36
问题 I have created an angular material date picker component to use with formly , and tried to set it to use GB for the locale so that dates are shown as 26/07/2019 . However, when typing in the date, it parses as US still, resulting in invalid date errors being shown. I have tried to include moment and the MomentDateAdapter module but have been unable to solve the issue. Here is a stackblitz I've set my providers like so: providers: [ { provide: LOCALE_ID, useValue: 'en-GB' }, { provide:

Server side errors handling with angular-formly

二次信任 提交于 2020-01-06 23:53:01
问题 I'm looking for solution on how I can display errors that the server respond, this is the respond for every invalid submission so I want to make the error handler in the app level and not in a controller. I want to display the errors both on the FORM level and on the field level. I have a REST API that in case of error return the following JSON object: { "message": "Validation error: Validation notEmpty failed,\nValidation error: Validation isEmail failed", "errors": [ { "field": "username",

How to load angular-formly vm.fields object from remotely-generated json?

断了今生、忘了曾经 提交于 2019-12-13 20:54:13
问题 In my application I have dynamic field sets on what is otherwise the same form. I can load them from the server as javascript includes and that works OK. However, it would be much better to be able to load them from a separate API. $.getJSON() provides a good way to load the json but I have not found the right place to do this. Clearly it needs to be completed before the compile step begins. I see there is a fieldTransform facility in formly. Could this be used to transform vm.fields from an

Angular Formly: how to add class to wrapping div

限于喜欢 提交于 2019-12-13 14:06:02
问题 <formly-form model="vm.model" fields="step.inputs" options="vm.options"> <div style="text-align:right"> <button type="submit" wz-next class="btn btn-primary submit-button" ng-disabled="innerForm.$invalid">Næste</button> </div> </formly-form> Using the above markup would generate a more og less standard formly form, but my issue is that based on values set in the templateOptions of my fields, i want to be able to add a class to the formly-field div. So an example would be: inputs: [ { key:

Angular Formly Nested selects

久未见 提交于 2019-12-12 01:25:21
问题 I'm trying to achieve a series of nested SELECT with Formly. My options look like this : $scope.productsList = [{ name : 'product1', options : [ name : 'option1Product1', name : 'option2Product1' ] }, { name : 'product2', options : [ name : 'option1Product2', name : 'option2Product2' ] } ] My first select is easy : { type: 'select', key: "product", templateOptions: { label: 'Product', options: $scope.productsList, "valueProp": "name", "labelProp": "name" } } But my second select doesn't get

Open modal form containing form created from ngx-formly from another ngx-formly form

五迷三道 提交于 2019-12-11 08:13:07
问题 I'm currently using ngx-formly to dynamically create a bunch of Angular forms from JSON, which works really nicely. I have a peculiar use case where a custom button on a form, should open a modal dialog containing another form on click, which would also contain a form created using ngx-formly. The example I saw on the ngx-formly site use a custom button, and creates a custom component with .ts files, but I want to avoid that since I would have several forms doing this, and I don't want to

Angular-Formly: Hide/Disable Fields from Service

烂漫一生 提交于 2019-12-10 21:42:58
问题 I have a service in which i try to disable an angular-formly field: formField.templateOptions.disabled = true; Even though the templateOption object is correct, the field is not disabled: "templateOptions": { "type": "text", "placeholder": "", "label": "Single Line Test", "disabled": true }, Is this not possible? Thanks. Edit: Form Code before disabling in service { "type": "input", "key": "single_line_test", "templateOptions": { "type": "text", "placeholder": "", "label": "Single Line Test"