0

I was trying to implement this widget to my Angular app. For the second part I was able to create a custom js file in my assets folder, create a .d.ts file for it and successfully imported the function in my component.

But for the first part:

<script async src="https://telegram.org/js/telegram-widget.js?5" data-telegram-login="samplebot" data-size="large" data-onauth="onTelegramAuth(user)" data-request-access="write"></script>

If I do it with plain HTML and js, it will fetch from the website and generate a login button. Yet I tried simply pasting it into my component's HTML, it does not get rendered. As it is not a function nor a variable, I am not sure how can I place it into a specific div in the component.

Please help.

jeffffc
  • 772
  • 4
  • 13
  • Are you able to show how you tried adding this into your component's HTML? Did you get any errors? – OliverRadini Nov 07 '18 at 08:49
  • Possible duplicate of [Need to insert Script tag in angular 2](https://stackoverflow.com/questions/42458346/need-to-insert-script-tag-in-angular-2) – lumio Nov 07 '18 at 08:49
  • @OliverRadini I simply put the quoted script tag into a div, no special stuff. – jeffffc Nov 07 '18 at 09:28
  • @lumio I tried DomSanitizer, no luck. And tried the "script-hack" method, I see that from "Network" of devtool it finally fetch the js file from telegram.org but the button still does not show up. – jeffffc Nov 07 '18 at 09:30

0 Answers0