Created
August 11, 2020 17:13
-
-
Save DavidCabral/c914eb7f2f2468c10ec1b8ede3dec058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div [innerHTML]="html" > | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, Input, OnInit} from '@angular/core'; | |
import {DomSanitizer} from '@angular/platform-browser'; | |
@Component({ | |
selector: 'app-spacer', | |
templateUrl: './app-spacer.component.html', | |
styleUrls: ['./app-spacer.component.scss'] | |
}) | |
export class AppSpacerComponent implements OnInit { | |
@Input() totalSpace = 0; | |
html: any; | |
constructor(public sanitizer: DomSanitizer) { } | |
ngOnInit(): void { | |
let spaces = ' '; | |
for (let index = 1; index <= this.totalSpace - 1 ; index++) { | |
spaces += ' '; | |
} | |
this.html = this.sanitizer.bypassSecurityTrustHtml(spaces); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment