Adding OnPush to more components
This commit is contained in:
parent
648be481d7
commit
63fb733dc2
@ -1,11 +1,12 @@
|
|||||||
import { Component, OnInit, ViewChild, ElementRef, AfterViewInit, Input } from '@angular/core';
|
import { Component, OnInit, ViewChild, ElementRef, AfterViewInit, Input, ChangeDetectionStrategy } from '@angular/core';
|
||||||
import * as ClipboardJS from 'clipboard';
|
import * as ClipboardJS from 'clipboard';
|
||||||
import * as tlite from 'tlite';
|
import * as tlite from 'tlite';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-clipboard',
|
selector: 'app-clipboard',
|
||||||
templateUrl: './clipboard.component.html',
|
templateUrl: './clipboard.component.html',
|
||||||
styleUrls: ['./clipboard.component.scss']
|
styleUrls: ['./clipboard.component.scss'],
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class ClipboardComponent implements AfterViewInit {
|
export class ClipboardComponent implements AfterViewInit {
|
||||||
@ViewChild('btn') btn: ElementRef;
|
@ViewChild('btn') btn: ElementRef;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, Input, OnChanges } from '@angular/core';
|
import { Component, Input, OnChanges, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
|
||||||
import { AssetsService } from 'src/app/services/assets.service';
|
import { AssetsService } from 'src/app/services/assets.service';
|
||||||
import { Transaction } from 'src/app/interfaces/electrs.interface';
|
import { Transaction } from 'src/app/interfaces/electrs.interface';
|
||||||
|
|
||||||
@ -6,6 +6,7 @@ import { Transaction } from 'src/app/interfaces/electrs.interface';
|
|||||||
selector: 'app-miner',
|
selector: 'app-miner',
|
||||||
templateUrl: './miner.component.html',
|
templateUrl: './miner.component.html',
|
||||||
styleUrls: ['./miner.component.scss'],
|
styleUrls: ['./miner.component.scss'],
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class MinerComponent implements OnChanges {
|
export class MinerComponent implements OnChanges {
|
||||||
@Input() coinbaseTransaction: Transaction;
|
@Input() coinbaseTransaction: Transaction;
|
||||||
@ -16,6 +17,7 @@ export class MinerComponent implements OnChanges {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private assetsService: AssetsService,
|
private assetsService: AssetsService,
|
||||||
|
private cd: ChangeDetectorRef,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
@ -56,6 +58,7 @@ export class MinerComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
this.cd.markForCheck();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user