我正在开发一个包含大量JQuery的项目.例如,JQuery到处都有很多$符号
$(document).ready(function () {
$('input[type=file]').wl_File({
url: '/Admin/PolicyInventory/UploadDocuments',
onFileError: function (error, fileobj) {
$.msg('file is not allowed: ' + fileobj.name, {
header: error.msg + ' Error ',
live: 10000
});
}
});
...
Run Code Online (Sandbox Code Playgroud)
我的问题是,这个美元符号是什么意思?为什么它在所有地方使用,我如何理解和解释它?它让我想起了我在大学学习Scheme的可怕日子,不得不把括号放在任何地方而不知道我为什么要这样做.
考虑这个代码(来自这里):
父组件:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
template: `<app-child (valueChange)='displayCounter($event)'></app-child>`
})
export class AppComponent implements OnInit {
ngOnInit() {
}
displayCounter(count) {
console.log(count);
}
}
Run Code Online (Sandbox Code Playgroud)
子组件:
import { Component, EventEmitter, Output } from '@angular/core';
@Component({
selector: 'app-child',
template: `<button class='btn btn-primary' (click)="valueChanged()">Click me</button> `
})
export class AppChildComponent {
@Output() valueChange = new EventEmitter();
Counter = 0;
valueChanged() { // You can give any function name
this.counter = this.counter + 1;
this.valueChange.emit(this.counter);
} …Run Code Online (Sandbox Code Playgroud)