我爲我的Angular 2 Typescript應用程序使用npm install sendgrid。使用Send Grid和我的Angular2 Typescript應用程序時的參考錯誤
我已經安裝sendgrid和包,但我不斷收到一個控制檯錯誤:
「的ReferenceError:要求沒有定義」
這是我的代碼示例(我已經刪除了原因很明顯鍵):)
var sendgrid_api_key = "key goes here";
var sendgrid = require('sendgrid')(sendgrid_api_key);
sendgrid.send({
to: '[email protected]',
from: '[email protected]',
subject: 'Hello Mark Test',
text: 'My first email through SendGrid.'
}, function(err, json) {
if (err) { return console.error(err); }
console.log(json);
});
這與Angular有什麼關係? –
我在我的角度2項目中使用發送網格,你知道如何讓發送網格在這個環境中工作嗎? – AngularM