I am trying to implement a twitter share button in my website using the following code
<a class="btn btn-small" href=" https://twitter.com/intent/tweet?source=tweetbutton&text={{name}}&url=https://stage.mutterfly.in+{{url}}" >
<i class="fa fa-twitter" aria-hidden="true" style="height: 30px; width:30px; color:black"></i>
</a>
where {{text}}
is coming from api response and {{url}} is from _route.url which is the current url.
The problem is this link isn’t accepting my dynamic data and showing unsafe url error.
How do I insert dynamic text and url into this link and make it work?
2
Answers
You can use this code, i use codeigniter
You can get the value by using a method in the typescript as below,
Your method must be as