【发布时间】:2019-03-20 00:46:54
【问题描述】:
我正在构建一个使用 Node-red 的服务,仅在向 127.0.0.1:1880/hello(node-red 端口)发出 GET 请求时发送电子邮件被触发并且 Angular 4 webapp (127.0.0.1:3000) 访问客户端。
当我从 浏览器 访问 thr /hello 页面时,我在我的个人电子邮件帐户中收到一封来自 node-red 的电子邮件。
问题是当按下按钮测试对node-red的http get请求时,什么都没有发生。
使用 Ubuntu 16.04 LTS
节点 8.15
npm 6.4
Node-RED 0.20.2
节点红色流:
NODE-RED FLOW SEND EMAIL IMAGE
[{"id":"35dcdbd9.a99684","type":"tab","label":"流 1","disabled":false,"info":""},{"id":"dcdb9a4e.db2eb8","type":"debug","z":"35dcdbd9.a99684","name": "","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":450," y":180,"wires":[]},{"id":"aa98d38f.846af","type":"e-mail","z":"35dcdbd9.a99684","server":"smtp .gmail.com","port":"465","secure":true,"tls":true,"name":"andre.def93@gmail.com","dname":"","x" :500,"y":320,"wires":[]},{"id":"f1aea493.ec0e78","type":"http 响应","z":"35dcdbd9.a99684","name":"","statusCode":"","headers":{},"x":670,"y":260,"wires": []},{"id":"747c3f58.892dd","type":"http 在","z":"35dcdbd9.a99684","name":"","url":"/hello","method":"get","upload":false,"swaggerDoc":"", "x":120,"y":260,"wires":[["dcdb9a4e.db2eb8","aa98d38f.846af","f1aea493.ec0e78"]]}]
Angular 4.1.3 应用
我的组件.ts:
[...]
import { Http } from '@angular/http';
[...]
constructor(
private http: Http,
[...]
) { }
[...]
test(){
this.http.get('http://127.0.0.1:1880/hello');
}
[...]
我的组件.html:
[...]
<button class="primary" (click)="test()">
<div *ngIf="!issueInProgress">
<span>TEST</span>
</div>
</button>
[...]
谢谢大家!
【问题讨论】:
标签: angular typescript node-red angular4-httpclient