constructor (
private myService: MyService,
) {}
onMyButton() {
this.myService.triggerOnMyButton();
}
constructor (
private myService: MyService,
) {}
ngOnInit() {
this.myService.trigger$.subscribe(() => this.myMethod());
}
private _trigger = new Subject<void>();
get trigger$() {
return this._trigger.asObservable();
}
public triggerOnMyButton() {
this._trigger.next();
}
export default class MyClass {
start() {
this.elem = document.querySelector('.elem');
this.elem.addEventListener('click', (event) => this.check(event));
}
check(e) {
//код
}
}
this.elem.addEventListener('click', this.check.bind(this));
$ = jQuery; // загрузили данные
delete window.$ // - и нету.
// После уничтожения всех ссылок, GC вычистит саму сущность из памяти.
cat1.__proto__.__proto__.__proto__ === Dog.prototype
Dog.prototype = Mammal.prototype;
const delay = time => new Promise (resolve => setTimeout(resolve, time));
async function run() {
const results = [];
for (const domain of domains) {
await delay(3000);
results.push(await domainInfo(domain));
}
return results;
}
run().then(function(results) {
$.ajax({...})
});;
showPanel="false" isOpen="false"
<mat-form-field class="example-full-width">
<input type="text" matInput placeholder="serch" [matAutocomplete]="auto" [formControl]="searchStr">
<mat-autocomplete #auto="matAutocomplete" showPanel="false" isOpen="false" *ngIf="films?.results?.length">
<mat-option (onSelectionChange)="selectedFilm(film)" *ngFor="let film of films.results" [value]="film.title">
<img class="example-option-img" aria-hidden [src]="getUrlImage(film.poster_path)" height="25">
<span>{{film.title}}</span>
</mat-option>
</mat-autocomplete>
</mat-form-field>