Angular2 http.post gets executed twice

后端 未结 3 2190
旧巷少年郎
旧巷少年郎 2020-12-03 02:26

I came across a weird issue where the Angular2\'s (RC1) Http service executes the http.post call twice. I\'ve debugged my app and I know for a fact this is not a click event

3条回答
  •  青春惊慌失措
    2020-12-03 03:07

    This was happening to me because I have (key.enter)="someSubmitFunction()" on one of the input fields of a form. When I hit enter on this field the form would submit twice. Apparently, this wasn't needed. When I removed this, the form would still submit when I hit enter, but now only once.

提交回复
热议问题