我刚刚创建了一个新的laravel项目,我正在运行一个Homestead vagrant box
vagrant init laravel/homestead
之后
流浪汉
当我使用vagrant ssh它时没有问题,我可以访问流浪盒,但是当我想用Heidisql连接到数据库时,我收到连接错误:
无法连接到'localhost'上的mysql服务器(10061)
这是我的设置
我正在使用的密码="秘密"
我有一个输入字段,当用户单击某个按钮时,需要将其聚焦并完全选择其文本值(这样当用户键入时,他们会替换整个值)。
这是输入字段的标记:
<input type="text" id="descriptionField" class="form-control">
Run Code Online (Sandbox Code Playgroud)
...以及负责焦点/选择的功能:
public copy(): void {
document.getElementById("descriptionField").focus();
document.getElementById("descriptionField").select();
}
Run Code Online (Sandbox Code Playgroud)
.focus()工作正常,但.select()抛出错误:
TS2339: Property 'select' does not exist on type 'HTMLElement'.
Run Code Online (Sandbox Code Playgroud)
我尝试过寻找解决方案,但大多数都依赖于 jQuery。有没有办法通过本机实现或 TypeScript 来解决这个问题?
我需要做一个密码模式验证器
密码应具有:
我发现此正则表达式模式:
Validators.pattern('/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!$%@#£€*?&]')
Run Code Online (Sandbox Code Playgroud)
但是,验证器始终声称我的输入无效
errors:
pattern:
actualValue: "Test1234"
requiredPattern: "^/^(?=.*[A-Za-z])(?=.*d)[A-Za-zd!$%@#£€*?&]$"
Run Code Online (Sandbox Code Playgroud)
根据https://regex101.com/r/AfAdKp/1,该值应该是有效的。
编辑:澄清一下,Test1234应该工作
我正在尝试使用 laravel 发送电子邮件。这适用于多个功能,但使用这个功能我遇到了一个奇怪的错误。
这是我正在使用的代码
$offerte = DB::table('offertes')
->select('*')
->where('id', '=', $offerte_id)
->get();
Mail::send('emails.offerte_reactie', ['offerte' => $offerte, 'user' => $user, 'message_text' => $message_text], function ($message) use ($user)
{
$message->from($user->email, 'Foodtruckbestellen.be');
$message->to($offerte->email);
$message->subject('Reactie offerte Foodtruckbestellen.be');
});
Run Code Online (Sandbox Code Playgroud)
但是,当我想发送邮件时,出现错误
未定义变量:offerte
行$message->to($offerte->email); 在 PHPSTORM 中确实用红色下划线表示,我没有在电子邮件中使用该变量。所以我确定这就是我的错误所在,我只是找不到解决方法。
我正在使用这个Angular-2-datepicker.一切正常,但每次我尝试设置[(日期)]属性时,它都会给我错误.
date.getMonth不是函数
我查了一些信息,发现它可能是因为我的变量不是类型日期,但是我的是,所以我现在我被困住了,无法找到解决方案.
我的HTML:
...
<material-datepicker dateFormat="DD-MM-YYYY" weekStart="1" [(date)]="definitionDetails.From"></material-datepicker>
...
Run Code Online (Sandbox Code Playgroud)
我的型号:
export class ClosingDayDefinition implements Serializable<ClosingDayDefinition> {
ID: number;
DescriptionID: number;
Info: models.DefinitionDetailInfo;
Description: models.DefinitionDescription;
CodeId: number;
From: Date;
To: Date;
Recurring: boolean;
Holiday: boolean;
Groups: Array<models.ClosingDayGroup>;
TypeName: string;
Run Code Online (Sandbox Code Playgroud)
我的组件:
...
public definitionDetails: models.ClosingDayDefinition;
...
Run Code Online (Sandbox Code Playgroud)
Var日志:
I have a comparison function that checks if the user has changed any property values in the objects like this.
private checkForChanges(): boolean {
if (_.isEqual(this.definitionDetails, this.originalDetails) === true) {
return false;
} else {
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
this works great, however now I want to console.log changes which property is changed if there are any changes.
I've tried this:
console.log(_.difference(_.keys(this.originalDetails), _.keys(this.definitionDetails)));
Run Code Online (Sandbox Code Playgroud)
but I always get [] so I assume my syntax is wrong.
What's the correct way to …
我正在尝试使用Kendo UI创建一个下拉列表,除了在屏幕加载时具有默认选择值之外,它工作得很好.
根据他们的文档,我的代码应如下所示:
HTML:
<kendo-dropdownlist formControlName="description"
[data]="definitionData.Languages"
[(ngModel)]="languageValue"
[textField]="'Value'"
[valueField]="'Key'"
[value]="2"
[valuePrimitive]="true">
</kendo-dropdownlist>
<span class="left col-xs-6">
<input type="text" id="descriptionField" class="form-control" [value]="getValue(descriptionForm.controls.description.value)" #descriptionField (blur)="updateDescriptionValue(descriptionField.value, languageValue)" />
</span>
Run Code Online (Sandbox Code Playgroud)
零件:
public descriptionForm: FormGroup = new FormGroup({
description: new FormControl()
});
Run Code Online (Sandbox Code Playgroud)
我的下拉列表有效,但加载页面时默认选中的值为空白,它应该是对象 Key: 2
注意:我不想使用,[defaultItem]因为它只会复制该项目,这意味着它将在下拉列表中2次.
我尝试了很多东西,但我无法弄清楚我应该做些什么!
提前致谢
我导入服务时出错,但我不明白为什么
import { CDService } from "../../services/definition";
constructor(
private toastyCommunicationService: ToastyCommunicationService,
private CDService : CDService,
private SharedService: SharedService,
private DatePipe: DatePipe
) { }
Run Code Online (Sandbox Code Playgroud)
我让我的服务很空洞,因为我对错误感到非常沮丧,不知道是什么导致了它.
export class CDService {
}
Run Code Online (Sandbox Code Playgroud)
现在我收到了错误
EXCEPTION: Uncaught (in promise): Error: DI Error
Error: DI Error
Run Code Online (Sandbox Code Playgroud)
我有两个问题:
1) DI错误到底是什么?
2)我该如何解决这个错误?
我试图利用Angular Material表。我正在尝试使用与示例相同的代码,但是当我必须定义时会遇到问题[dataSource]="data"。
这个问题听起来很愚蠢,但是我的表数据是一个简单的对象数组,如何实现呢?
为了解释起见,假设我的数据如下所示:
public data = [{ ID: 1, Code: "Hi" }, { ID: 2, Code: "Bye" }];
这是我目前拥有的代码:
<div class="example-container mat-elevation-z8">
<mat-table #table [dataSource]="data">
<ng-container matColumnDef="number">
<mat-header-cell *matHeaderCellDef> Number </mat-header-cell>
<mat-cell *matCellDef="let row"> {{ row.ID }} </mat-cell>
</ng-container>
<ng-container matColumnDef="Code">
<mat-header-cell *matHeaderCellDef> Code </mat-header-cell>
<mat-cell *matCellDef="let row">{{row.Code}}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
</div>
Run Code Online (Sandbox Code Playgroud) 所以我有2个对象数组,它看起来像这样
this.balanceCodes = [
{ ID: 1, StringValue: "dummy" },
{ ID: 2, StringValue: "data" }
];
this.allCodes = [
{ ID: 1, StringValue: "dummy", Color: "red", Order: "low" },
{ ID: 2, StringValue: "data", Color: "green", Order: "medium" },
{ ID: 3, StringValue: "extra", Color: "black", Order: "low" },
{ ID: 4, StringValue: "options", Color: "grey", Order: "high" }
];
Run Code Online (Sandbox Code Playgroud)
我想过滤掉this.balanceCodes(基于ID)的对象
所以期望的结果是:
this.result = [
{ ID: 3, StringValue: "extra", Color: "black", Order: "low" },
{ ID: …Run Code Online (Sandbox Code Playgroud) angular ×8
typescript ×6
javascript ×4
laravel ×2
lodash ×2
datepicker ×1
email ×1
homestead ×1
kendo-ui ×1
mysql ×1
php ×1
regex ×1