我玩一个简单的Meteor Angular 2应用程序,只能从数据库中读取。我有另一个更改数据库的应用程序。但是当数据库发生变化时,我在Meteor应用程序上出错了。
Exception in queued task: EXCEPTION: Error in client/match.html:0:19
ORIGINAL EXCEPTION: TypeError: Cannot read property 'league' of undefined
ORIGINAL STACKTRACE:
TypeError: Cannot read property 'league' of undefined
at DebugAppView._View_MatchComponent0.detectChangesInternal (MatchComponent.template.js:101:59)
at DebugAppView.AppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57326:14)
at DebugAppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57415:44)
at DebugAppView.AppView.detectViewChildrenChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57346:34)
at DebugAppView._View_MatchesComponent1.detectChangesInternal (MatchesComponent.template.js:106:8)
at DebugAppView.AppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57326:14)
at DebugAppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57415:44)
at DebugAppView.AppView.detectContentChildrenChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57341:37)
at DebugAppView._View_MatchesComponent0.detectChangesInternal (MatchesComponent.template.js:65:8)
at DebugAppView.AppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57326:14)
ERROR CONTEXT:
[object Object]
我使用autopublish收集:
import {Mongo} from 'meteor/mongo';
export let MatchCollection = new Mongo.Collection('matches');
和角度分量:
export class MatchesComponent
{
matches;
constructor() {
this.matches = MatchCollection.find();
}
}
注意:Meteor Blaze版本效果很好。我是Meteor Angular2的新手。
感谢您的帮助。
答案 0 :(得分:1)
我猜您使用的是*ngFor
。
您可以使用这种更稳定的方式
this.matches = MatchCollection.find().fetch();
MatchCollection.find();
返回Mongo.Cursor<any>
;
MatchCollection.find().fetch();
返回Array<any>
很奇怪,bug应该已经修好了......
答案 1 :(得分:0)
看起来外部更改删除了文档中的属性名称<?php
/**
* This example shows sending a message using PHP's mail() function.
*/
require 'PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('someemail@gmail.com', 'Admin');
//Set who the message is to be sent to
$mail->addAddress('someemail@yahoo.com', 'First Last');
//Set the subject line
$mail->Subject = 'This is the subject';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
//$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->IsHTML(false);
$mail->Body = 'This is a test';
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
,您的angular2视图会在某处使用。
通过league
查看文档,了解文档在外部流程修改之前和之后的样式。