when it delete success,  why not just reinvocation the GET method to get
the NOW list?

Partha Majumdar <partha6...@gmail.com> 于2018年9月24日周一 下午4:55写道:

> Dear Sir/Madam,
>
> I am new to Angular. I have started programming using Angular and Node
> since 17-Sep-2018.
>
> I have a page where I display a list of currencies and allow for deleting
> individual currencies from the list.
>
> On clicking the Delete button, the onDelete() function is firing properly
> and calling the DeleteCurrency() service. The message is propagated to my
> node service and the data is deleted from the database. However, when the
> reply is received, the list should refresh without the deleted currency.
> This is not happening.
>
> I am attaching my angular and node code for your kind reference.
>
> Please help.
>
> Regards,
> Partha
>
> *** ANGULAR SIDE OF TE CODE ***
>
> deleteCurrency(currencyCode: string) {
> this.httpClient.delete<{message: string}>('
> http://localhost:3000/api/currency/' + currencyCode)
> .subscribe(() => {
> alert('BEFORE DELETE:' + this.currencyList.length);
> const updatedCurrencies = this.currencyList.filter(currency => currency.
> currencyCode !== currencyCode);
> this.currencyList = updatedCurrencies;
> alert('AFTER DELETE:' + this.currencyList.length);
> this.currencyListUpdated.next([...this.currencyList]);
> });
> }
>
> *** CODE ON NODE JS ***
>
>
> router.delete("/:currencyCode", (request, response, next) => {
> (async () => {
> const SQLCurrencyDeleteStatement = "DELETE CURRENCY " +
> " WHERE CURRENCY_CODE = " + "'" + request.params.currencyCode + "';";
> console.log(SQLCurrencyDeleteStatement);
>
> returnValue = await executeUpdate(paikariConn, SQLCurrencyDeleteStatement
> );
> console.log(returnValue);
> response.status(201).json({
> message: "Currency deleted successfully"
> });
> })();
> });
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+unsubscr...@googlegroups.com.
> To post to this group, send email to angular@googlegroups.com.
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to