angular - Angular2 - Execute code after observable content update -


i need create routine gets data http service, , populates <form>, automatically calls submit() on generated form:

<form  target="_top" #paymentform action="{{payment?.url}}" method="post"> <input  *ngfor="let d of payment?.data | keys" name="{{d}}" value= {{payment.data[d]}}> </form> 

to populate form request returns payment object, containing url , form data posted:

this.globalsservice.placeorder(this.globalsservice.shoppingcart)     .subscribe(res => {                 this.payment = res;                  this.paymentform.nativeelement.submit()          }); 

even though code executes , data loaded form properly, @ moment submit() action executed form not yet populated, , therefore redirect wrong , values mmissing.

i looking elegant solution not involve settimeout, redirecting route or using lifecycle hooks.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -