【发布时间】:2017-03-29 18:01:00
【问题描述】:
我尝试将请求从前端(angular2)发送到后端(ruby,sinatra)。 现在,两台服务器都在一台计算机上工作(localhost:3001 上的角度,localhost:9292 上的 sinatra)
我使用 auth 示例 (http://embed.plnkr.co/TIPmK3/?show=preview),并希望将用户数据发送到 sinatra。
我在app/_services/authentication.service.ts看到了有趣的字符串:
return this.http.post('/api/authenticate', JSON.stringify({ username: username, password: password }))
.map((response: Response) => {...}
但是,如果在 http://localhost:9292/login 上替换 '/api/authenticate',则不会发生任何事情。请求未发送,没有错误。仅加载。
谁能帮帮我?
【问题讨论】:
标签: angular