我希望该电子邮件的格式如下:a@bc
哪种方法最好?
我有一个注册组件,我有这样的字段:
<mat-form-field>
<input matInput placeholder="Email" name="email" [(ngModel)]="email" required>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
在我的 usersRouter 我有注册功能:
router.post('/users/register', (req, res) => {
...
const user = new User({
...
email: req.body.email,
...
});
...
});
Run Code Online (Sandbox Code Playgroud)
另外,我使用 mongo 并且在 UserSchema 中我有这个用于电子邮件:
email: {
type: String,
required: true
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我有一个像这样的饼图:
this.canvas = document.getElementById('chart');
this.ctx = this.canvas.getContext('2d');
const myChart = new Chart(this.ctx, {
type: 'pie',
data: {
labels: names,
datasets: [{
label: '# of dogs',
data: data,
backgroundColor: color???,
borderWidth: 1
}]
},
options: {
responsive: false,
display: true
}
});
Run Code Online (Sandbox Code Playgroud)
数据不是固定的数据。它是一个数组,可以包含不同的数据。如何使饼图的每一块都有不同的颜色?
谢谢!