{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/6895","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/6895/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/6895/comments","events_url":"https://api.github.com/repos/angular/angular/issues/6895/events","html_url":"https://github.com/angular/angular/issues/6895","id":131423942,"number":6895,"title":"How to use observable operators like debounceTime and switchMap for asynchronous validations","user":{"login":"templth","id":558344,"avatar_url":"https://avatars.githubusercontent.com/u/558344?v=3","gravatar_id":"","url":"https://api.github.com/users/templth","html_url":"https://github.com/templth","followers_url":"https://api.github.com/users/templth/followers","following_url":"https://api.github.com/users/templth/following{/other_user}","gists_url":"https://api.github.com/users/templth/gists{/gist_id}","starred_url":"https://api.github.com/users/templth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/templth/subscriptions","organizations_url":"https://api.github.com/users/templth/orgs","repos_url":"https://api.github.com/users/templth/repos","events_url":"https://api.github.com/users/templth/events{/privacy}","received_events_url":"https://api.github.com/users/templth/received_events","type":"User","site_admin":false},"labels":[{"id":393879365,"url":"https://api.github.com/repos/angular/angular/labels/comp:%20forms","name":"comp: forms","color":"c5def5","default":false},{"id":375497160,"url":"https://api.github.com/repos/angular/angular/labels/freq2:%20medium","name":"freq2: medium","color":"fbca04","default":false},{"id":130606845,"url":"https://api.github.com/repos/angular/angular/labels/type:%20feature","name":"type: feature","color":"EEEEEE","default":false},{"id":375506809,"url":"https://api.github.com/repos/angular/angular/labels/workaround2:%20non-obvious","name":"workaround2: non-obvious","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-02-04T17:53:18Z","updated_at":"2016-12-21T13:16:49Z","closed_at":null,"body":"I find observables really powerful. In the context of HTTP, it's a killer feature since we can use the `debounceTime` and `switchMap` operators to control the sent requests and cancel them if necessary.\n\nWhen using asynchronous validators, it seems that we don't have access to this feature since the call of the validator is internally done and we can't configure the way it's triggered.\n\nI would like to implement something similar than the following within asynchronous validation:\n\n```\nthis.ctrl.valueChanges.debounceTime(500).switchMap((val) => {\n  return this.http.get('https://...');\n}).subscribe((data) => {\n  // here would be the validation\n});\n```\n\nIs it something supported (or that will be) at the form validation level?\n\nThanks very much by advance,\nThierry\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/268520585","html_url":"https://github.com/angular/angular/issues/6895#issuecomment-268520585","issue_url":"https://api.github.com/repos/angular/angular/issues/6895","id":268520585,"user":{"login":"karolmie1","id":9072936,"avatar_url":"https://avatars.githubusercontent.com/u/9072936?v=3","gravatar_id":"","url":"https://api.github.com/users/karolmie1","html_url":"https://github.com/karolmie1","followers_url":"https://api.github.com/users/karolmie1/followers","following_url":"https://api.github.com/users/karolmie1/following{/other_user}","gists_url":"https://api.github.com/users/karolmie1/gists{/gist_id}","starred_url":"https://api.github.com/users/karolmie1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karolmie1/subscriptions","organizations_url":"https://api.github.com/users/karolmie1/orgs","repos_url":"https://api.github.com/users/karolmie1/repos","events_url":"https://api.github.com/users/karolmie1/events{/privacy}","received_events_url":"https://api.github.com/users/karolmie1/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T13:16:49Z","updated_at":"2016-12-21T13:16:49Z","body":"@bezhermoso \r\nCould you please explain few things about your code?\r\nWhat is ValidationResult? \r\n\r\nWhere do I put my request to server? instead of this.asyncValidation?"}}
{"actor":{"display_login":"karolmie1"}}