GiliAlves
3/22/2019 - 12:44 PM

Component Add-this

1 - Importar em 'app.module.ts':
    import { AddThisComponent } from '../pages/details/add-this/add-this';
2 - Adiconar em details a pasta:
    add-this
3 - Adiconar ao 'details.css':

@media (min-width: 992px) {
    add-this-share {
        float: right;
    }
}
@media (max-width: 991px) {
    add-this-share {
        float: left;
        width: 100%;
    }
}
@media (max-width: 1199px) {
    .detalhe_titulo {
        height: 57px;
    }
}

4 - Adicionar em 'details.html':
   
   <div class="detalhe_titulo">
        <span class="tiposubtipo">Código: {{property.code}} - {{property.finality}} / {{property.property_type}}</span>
        <add-this-share></add-this-share>
    </div>
@media (min-width: 1200px) {
    .at-share-btn-elements {
        width: 50%;
        float: right;
        margin-top: -25px;
    }
}
@media (min-width: 991px) {
    .at-share-btn-elements {
        width: 50%;
        float: right;
        margin-top: -38px;
        text-align: right;
    }
}
.at-share-btn-elements {
    width: 100%;
    float: right;
    text-align: left;
}
import { Component, AfterViewInit } from '@angular/core';

@Component({
    selector: 'add-this-share',
    template: `
        <div class="addthis_inline_share_toolbox_as3m"></div>
    `,
    styleUrls: ['add-this.scss']
    
})
export class AddThisComponent implements AfterViewInit {

    ngAfterViewInit() {
        if (window['addthis']) {
            window['addthis'].layers.refresh();
        } else {
            const script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = '//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5714f39f3e061698';
            document.getElementsByTagName('head')[0].appendChild(script);
        }
    }
}