#Beginner

20 messages · Page 1 of 1 (latest)

torpid sail
#

404 not found why this error is coming

spring summit
#

Because there is no resource with the url http://localhost:4200/posts. What do you expect to happen when sending a POST request to that URL, and why?

torpid sail
#

i have made a json ,postman for API work yesterday but i think with the change of localhost everything has changed and throwing error

spring summit
#

That doesn't answer my question. Do you understand that the server running on port 4200 is your Angular CLI server, and that this server is different from the backend server you might have which exposes your REST API?

vestal cloud
#

idk why this comming

#

can someone help to use template variable,

spring summit
#

Have you read the error message? What does it say? What don't you understand it what it says? What do you intend this code to do?

vestal cloud
#

i m trying to put input val into template var, and then push template var value to a function

spring summit
#

Also, an advice: when you have a new question, unrelated to this question, post it as a new question. Use a descriptive title for your question rather than "Beginner".

#

That doesn't answer any of my questions. And I have no idea of what you mean by "input val" or "template var".

vestal cloud
#

i tried to do the same as in angular example

#

#testvar is my template variable,

spring summit
#

You can't do that here because the input is inside an *ngIf. So your code is basically equivalent to the following TypeScript code:

if (!isEPSuccessSubmit) {
  const testvar = ...;
}
doUpdateEmailPhone(testvar);

testvar is not accessible, because it's declared inside the if block

vestal cloud
#

ooooo! thanks. 🤗

torpid sail
spring summit
#

OK. So which port is your API server running on?

torpid sail
#

postman

spring summit
torpid sail
spring summit
#

So, if you have the server still running, you need to send your requests to that URL, not http://localhost:4200/posts. And if you don't have a server running anymore, then you need to have one. HTTP responses can't magically be obtained from nothing.