File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 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' ;
23import { getStyle , rgbToHex } from '@coreui/coreui/dist/js/coreui-utilities' ;
34
45@Component ( {
56 templateUrl : 'colors.component.html'
67} )
78export 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 ) { }
1210
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' ) ;
1415 table . innerHTML = `
1516 <table class="w-100">
1617 <tr>
@@ -23,10 +24,8 @@ export class ColorsComponent implements OnInit {
2324 </tr>
2425 </table>
2526 ` ;
26-
2727 el . parentNode . appendChild ( table ) ;
2828 } ) ;
29-
3029 }
3130
3231 ngOnInit ( ) : void {
You can’t perform that action at this time.
0 commit comments