{"action":"created","issue":{"url":"https://api.github.com/repos/formly-js/ngx-formly/issues/1180","repository_url":"https://api.github.com/repos/formly-js/ngx-formly","labels_url":"https://api.github.com/repos/formly-js/ngx-formly/issues/1180/labels{/name}","comments_url":"https://api.github.com/repos/formly-js/ngx-formly/issues/1180/comments","events_url":"https://api.github.com/repos/formly-js/ngx-formly/issues/1180/events","html_url":"https://github.com/formly-js/ngx-formly/issues/1180","id":361145179,"node_id":"MDU6SXNzdWUzNjExNDUxNzk=","number":1180,"title":"Default Validation is not applied in First Use","user":{"login":"Sanjay10247","id":41230818,"node_id":"MDQ6VXNlcjQxMjMwODE4","avatar_url":"https://avatars0.githubusercontent.com/u/41230818?v=4","gravatar_id":"","url":"https://api.github.com/users/Sanjay10247","html_url":"https://github.com/Sanjay10247","followers_url":"https://api.github.com/users/Sanjay10247/followers","following_url":"https://api.github.com/users/Sanjay10247/following{/other_user}","gists_url":"https://api.github.com/users/Sanjay10247/gists{/gist_id}","starred_url":"https://api.github.com/users/Sanjay10247/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sanjay10247/subscriptions","organizations_url":"https://api.github.com/users/Sanjay10247/orgs","repos_url":"https://api.github.com/users/Sanjay10247/repos","events_url":"https://api.github.com/users/Sanjay10247/events{/privacy}","received_events_url":"https://api.github.com/users/Sanjay10247/received_events","type":"User","site_admin":false},"labels":[{"id":197471514,"node_id":"MDU6TGFiZWwxOTc0NzE1MTQ=","url":"https://api.github.com/repos/formly-js/ngx-formly/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-18T05:50:36Z","updated_at":"2018-09-20T11:51:22Z","closed_at":"2018-09-20T11:51:22Z","author_association":"NONE","body":"<!--\r\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\r\n-->\r\n\r\n**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[x] bug report => search GitHub for a similar issue or PR before submitting\r\n[ ] feature request\r\n[ ] support request\r\n```\r\n\r\n**Current behavior**\r\nDefault validation like max length and min length for a text input is not validating while first use but works fine when focus out and re-enter the text.\r\n\r\n**Expected behavior**\r\nValidation should work right from the first use.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\nPlease use the below link to reproduce the issue.\r\nhttps://stackblitz.com/edit/angular-vzcukk\r\n\r\n**What is the motivation/use case for changing the behavior?**\r\nTo make this reactive forms more usable.\r\n\r\n**Please tell us about your environment:**\r\n<!-- The operating system, IDE, package manager, HTTP server, ... -->\r\n\r\n* **Angular version:**\r\nAngular Version - 6.1.X\r\nngx-formly/core - 4.7.2\r\n\r\n* **Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]\r\n<!-- All browsers where this could be reproduced -->\r\nIn all Browsers irrespective of the version.\r\n\r\n* **Language:** [all | TypeScript X.X | ES6/7 | ES5] - ES7\r\n\r\n* **Node (for AoT issues):** `node --version` =10\r\n"},"comment":{"url":"https://api.github.com/repos/formly-js/ngx-formly/issues/comments/423154658","html_url":"https://github.com/formly-js/ngx-formly/issues/1180#issuecomment-423154658","issue_url":"https://api.github.com/repos/formly-js/ngx-formly/issues/1180","id":423154658,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzE1NDY1OA==","user":{"login":"aitboudad","id":1753742,"node_id":"MDQ6VXNlcjE3NTM3NDI=","avatar_url":"https://avatars2.githubusercontent.com/u/1753742?v=4","gravatar_id":"","url":"https://api.github.com/users/aitboudad","html_url":"https://github.com/aitboudad","followers_url":"https://api.github.com/users/aitboudad/followers","following_url":"https://api.github.com/users/aitboudad/following{/other_user}","gists_url":"https://api.github.com/users/aitboudad/gists{/gist_id}","starred_url":"https://api.github.com/users/aitboudad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aitboudad/subscriptions","organizations_url":"https://api.github.com/users/aitboudad/orgs","repos_url":"https://api.github.com/users/aitboudad/repos","events_url":"https://api.github.com/users/aitboudad/events{/privacy}","received_events_url":"https://api.github.com/users/aitboudad/received_events","type":"User","site_admin":false},"created_at":"2018-09-20T11:51:22Z","updated_at":"2018-09-20T11:51:22Z","author_association":"MEMBER","body":"to have a such behavior globally use custom `showError` see https://stackblitz.com/edit/angular-npnf5d\r\n\r\n```ts\r\nexport function showError(field: FieldType) {\r\n  return field.formControl && field.formControl.invalid && (field.formControl.dirty || (field.options.parentForm && field.options.parentForm.submitted) || (field.field.validation && field.field.validation.show));\r\n}\r\n\r\n@NgModule({\r\n  imports: [\r\n    FormlyModule.forRoot({\r\n      extras: { showError },\r\n      ...\r\n    }),\r\n  ],\r\n})\r\nexport class AppModule { }\r\n```"}}
{"actor":{"display_login":"aitboudad"}}