我想为新的选择做点什么,但是我在onChange()中得到的东西总是最后选择.如何在没有前缀和连字符的情况下获得正确的值?
继续教育,form.component.html
<select class="form-control custom-select" name="course_id" id="course_id" formControlName="course_id" (change)="onChange($event.target.value)">
<option value="">--Select--</option>
<option *ngFor="let course of course_list" [ngValue]="course.id">{{ course.name }}({{course.id}})</option>
</select>
Run Code Online (Sandbox Code Playgroud)
继续教育,form.component.ts
onChange(value) : void {
console.log('Course Value',value)
}
Run Code Online (Sandbox Code Playgroud)
例如:我得到的值为2:8.预期值为8
我们正在尝试匹配 crypto 和 crypto-js 输出。我们的要求是在浏览器中加密字符串,但加密不支持浏览器端加密。因此,我们尝试使用 crypto-js 来匹配输出。每次 crypto-js 都会产生不同的输出。
const crypto = require('crypto');
const CryptoJS = require('crypto-js');
const payload = {
name: 'John Doe'
}
// Node Package
function encryptNode(text) {
const cipher = crypto.createCipher('aes-256-cbc', 'devOps');
return cipher.update(Buffer.from(JSON.stringify(text)), 'utf8', 'hex') + cipher.final('hex');
}
console.log(encryptNode(payload));
// Browser Package
function encryptBrowser(text) {
const ciphertext = CryptoJS.AES.encrypt(JSON.stringify(text), 'devOps', { mode: CryptoJS.mode.CBC });
return ciphertext.toString(CryptoJS.format.Hex);
}
console.log(encryptBrowser(payload));
Run Code Online (Sandbox Code Playgroud)
输出:
加密(预期):dfe03c7e825e9943aa6ec61deb4a8a73fdba0016a13c59c628ce025f39d44c7c
加密js:4e5453abe7bd53d67d88aa4f040356c649fe0101366d05ce4c7d625cfd052cdc
Laravel 雄辩的查询是什么:
select * from `jobs` where 1 between min_experience and max_experience;
Run Code Online (Sandbox Code Playgroud)
我尝试了下面的查询,但这个查询用单引号封装了 where 1。
Job::whereRaw('? between min_experience and max_experience',1)->get();
select * from `jobs` where '1' between min_experience and max_experience;
Run Code Online (Sandbox Code Playgroud) 如何将表单数组索引传递给ng-bootstrap标题中的getCities函数,包括当前输入文本。考虑3是表格数组索引。
address.component.html
<input name="city" type="text" id="city" formControlName="city" [ngbTypeahead]="getCities">
Run Code Online (Sandbox Code Playgroud)
address.component.ts
getCities = (text$: Observable<string>) =>
text$
.debounceTime(300)
.distinctUntilChanged()
.switchMap(query =>
query.length < 2 ? [] : this.apiService.getCities(query).catch(() => {
return Observable.of([]);
});)
Run Code Online (Sandbox Code Playgroud) angular ×2
cryptography ×1
cryptojs ×1
eloquent ×1
encryption ×1
javascript ×1
laravel ×1
laravel-5 ×1
ng-bootstrap ×1
node.js ×1