{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/4933","labels_url":"https://api.github.com/repos/angular/angular/issues/4933/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/4933/comments","events_url":"https://api.github.com/repos/angular/angular/issues/4933/events","html_url":"https://github.com/angular/angular/issues/4933","id":113539829,"number":4933,"title":"Add possibility to reset Form value and states","user":{"login":"choeller","id":423277,"avatar_url":"https://avatars.githubusercontent.com/u/423277?v=3","gravatar_id":"","url":"https://api.github.com/users/choeller","html_url":"https://github.com/choeller","followers_url":"https://api.github.com/users/choeller/followers","following_url":"https://api.github.com/users/choeller/following{/other_user}","gists_url":"https://api.github.com/users/choeller/gists{/gist_id}","starred_url":"https://api.github.com/users/choeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choeller/subscriptions","organizations_url":"https://api.github.com/users/choeller/orgs","repos_url":"https://api.github.com/users/choeller/repos","events_url":"https://api.github.com/users/choeller/events{/privacy}","received_events_url":"https://api.github.com/users/choeller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-10-27T09:26:15Z","updated_at":"2016-01-08T08:04:05Z","closed_at":null,"body":"With the current Forms API is not possible to reset states like \"dirty\" or \"pristine\". \r\n\r\nA typical scenario would be, to have a form, and on submit add the entry to a database / list. After submitting the value the form should reset to the initial state. Also all flags should be resetted. \r\n\r\nWhen using the model-driven approach it is currently not possible at all to reset the values - only chance is to create a new form. This plnkr demonstrates the model-driven approach:\r\n\r\nhttp://plnkr.co/edit/vxr48zAIM8g4WFD25Ts8\r\n\r\nWhen using the template driven approach it is possible to reset the ng-model object to some initial state, but in this case the flags like dirty and pristine don't reset:\r\n\r\nhttp://plnkr.co/edit/rkhlr3vFHn7R6oMGTU7v\r\n\r\nWith this behaviour it is not possible to utilize the form states for something like canDeactive \r\n\r\nIMO there needs to be some way to reset the value and all flags of the form to the initial state. I still have no idea how this could be solved in the ng-model scenario, as there is no dedicated object for the form itself in controller - would it be correct to always reset the flags, when changing the ng-model object programmatically? like this:\r\n\r\n`\r\nthis.newEntry = {};\r\n` "},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/169927233","html_url":"https://github.com/angular/angular/issues/4933#issuecomment-169927233","issue_url":"https://api.github.com/repos/angular/angular/issues/4933","id":169927233,"user":{"login":"benediktberger","id":16606466,"avatar_url":"https://avatars.githubusercontent.com/u/16606466?v=3","gravatar_id":"","url":"https://api.github.com/users/benediktberger","html_url":"https://github.com/benediktberger","followers_url":"https://api.github.com/users/benediktberger/followers","following_url":"https://api.github.com/users/benediktberger/following{/other_user}","gists_url":"https://api.github.com/users/benediktberger/gists{/gist_id}","starred_url":"https://api.github.com/users/benediktberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benediktberger/subscriptions","organizations_url":"https://api.github.com/users/benediktberger/orgs","repos_url":"https://api.github.com/users/benediktberger/repos","events_url":"https://api.github.com/users/benediktberger/events{/privacy}","received_events_url":"https://api.github.com/users/benediktberger/received_events","type":"User","site_admin":false},"created_at":"2016-01-08T08:04:05Z","updated_at":"2016-01-08T08:04:05Z","body":"+1"}}