File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
- import { Component , OnInit } from '@angular/core' ;
1
+ import { Component , Inject , OnInit } from '@angular/core' ;
2
+ import { DOCUMENT } from '@angular/common' ;
2
3
import { getStyle , rgbToHex } from '@coreui/coreui/dist/js/coreui-utilities' ;
3
4
4
5
@Component ( {
5
6
templateUrl : 'colors.component.html'
6
7
} )
7
8
export class ColorsComponent implements OnInit {
8
- public themeColors ( ) : void {
9
- Array . from ( document . querySelectorAll ( '.theme-color' ) ) . forEach ( function ( el ) {
10
- const elem = document . getElementsByClassName ( el . classList [ 0 ] ) [ 0 ] ;
11
- const background = getStyle ( 'background-color' , elem ) ;
9
+ constructor ( @Inject ( DOCUMENT ) private _document : any ) { }
12
10
13
- const table = document . createElement ( 'table' ) ;
11
+ public themeColors ( ) : void {
12
+ Array . from ( this . _document . querySelectorAll ( '.theme-color' ) ) . forEach ( ( el : HTMLElement ) => {
13
+ const background = getStyle ( 'background-color' , el ) ;
14
+ const table = this . _document . createElement ( 'table' ) ;
14
15
table . innerHTML = `
15
16
<table class="w-100">
16
17
<tr>
@@ -23,10 +24,8 @@ export class ColorsComponent implements OnInit {
23
24
</tr>
24
25
</table>
25
26
` ;
26
-
27
27
el . parentNode . appendChild ( table ) ;
28
28
} ) ;
29
-
30
29
}
31
30
32
31
ngOnInit ( ) : void {
You can’t perform that action at this time.
0 commit comments