app/debug-tools/content-json/content-json.component.ts
selector | app-content-json |
styleUrls | ./content-json.component.scss |
templateUrl | ./content-json.component.html |
Properties |
|
Methods |
|
constructor()
|
Public jsonOutput |
jsonOutput()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
Public jsonUrl |
Type : string
|
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-content-json',
templateUrl: './content-json.component.html',
styleUrls: ['./content-json.component.scss']
})
export class ContentJsonComponent implements OnInit {
constructor() { }
public jsonUrl: string;
ngOnInit() {
const currentUrl = (window.location);
this.jsonUrl = currentUrl.origin + '/content' + currentUrl.pathname + '?format=json';
}
public jsonOutput(){
window.open(this.jsonUrl, "_blank");
}
}
<div (click)="jsonOutput()" class="content" title="Go to top">
<i class="icon-quickLinks-productCatalogue" title="JSON"> </i>
</div>
./content-json.component.scss
.content {
display: block; /* Hidden by default */
position: fixed; /* Fixed/sticky position */
top: 100px; /* Place the button at the bottom of the page */
right: 30px; /* Place the button 30px from the right */
z-index: 99; /* Make sure it does not overlap */
border: none; /* Remove borders */
outline: none; /* Remove outline */
background-color: red; /* Set a background color */
color: white; /* Text color */
cursor: pointer; /* Add a mouse pointer on hover */
padding: 10px; /* Some padding */
border-radius: 10px; /* Rounded corners */
font-size: 20px; /* Increase font size */
}