1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

send whatsapp message from angular 2 web app

Discussão em 'Angular' iniciado por vtechmonkey, Outubro 16, 2024 às 13:13.

  1. vtechmonkey

    vtechmonkey Guest

    Building a web app using angular 2, (or 4). Want to send a message through whatsapp. This works fine whatsapp://send?text=hi! to open whatsapp from the browser. I want to send the url of the current page. I can use {{url}} to print the url on the web page but I don't know how to set text={{url}} if you know what I mean.

    relevant part of the component `

    export class ActivityDetailsComponent implements OnInit {


    @Input() activity: any;
    @Output() close = new EventEmitter();
    error:any;
    navigated = false;
    sub: any;
    imageURL: string;
    location:Location;
    url: any;

    constructor(private activitiesService:ActivitiesService,
    private route: ActivatedRoute,
    private router: Router,
    private pics: PicsService,
    location:Location

    ) {

    this.location = location;
    this.url = this.location.path();

    }


    `

    relevant html `

    Send a link to this activity to your
    <a href="whatsapp://send?text=http://ec2-52-209-95-130.eu-west-
    1.compute.amazonaws.com:4200/activities/58c003d47513092fac820f09">whatsapp</a>
    contacts

    http://ec2-52-209-95-130.eu-west-1.compute.amazonaws.com:4200{{url}}


    `

    Continue reading...

Compartilhe esta Página