所以我想说我有以下网站:
<div class="hello"></div>
<div class="hello"></div>
<div class="hello world"></div>
<div class="hello"></div>
Run Code Online (Sandbox Code Playgroud)
使用以下代码,我将所有具有"hello"类的元素保存到数组中:
var inputs = document.getElementsByClassName('hello');
有什么方法可以排除所有具有"世界"类的元素,所以我只能获得三个结果吗?
我正在使用 NestJS 和 TypeORM。尝试调用存储库的 createMailLogEntry 方法时,出现以下错误:TypeError: this.mailLogEntryRepository.createMailLogEntry is not a function
我无法弄清楚出了什么问题。
mailing.service.ts
@Injectable()
export class MailingService {
constructor(@InjectRepository(MailLogEntryRepository) private mailLogEntryRepository: MailLogEntryRepository) { }
// ...
if(transferResult) {
await this.mailLogEntryRepository.createMailLogEntry({
creationDate: new Date(Date.now()),
from: mailContent.from,
to: mailContent.to,
subject: mailContent.subject,
text: mailContent.text,
html: mailContent.html,
cc: mailContent.cc,
bcc: mailContent.bcc,
});
}
}
}
Run Code Online (Sandbox Code Playgroud)
邮件日志条目.repository.ts
@EntityRepository(MailLogEntry)
export class MailLogEntryRepository extends Repository<MailLogEntry> {
async createMailLogEntry(mailLogEntryDto: MailLogEntryDto): Promise<MailLogEntry> {
const mailLogEntry = MailLogEntryRepository.createMailLogEntryFromDto(mailLogEntryDto);
return await mailLogEntry.save();
}
private static createMailLogEntryFromDto(mailLogEntryDto: MailLogEntryDto): MailLogEntry {
const …Run Code Online (Sandbox Code Playgroud)