3

Is there a way to embed a gist, which is given as a script:

<script 
src="https://gist.github.com/Slugpotato/bce9877d9c38d7415960e18fadc4efd7.js">
</script>

in Angular 4? I'm creating tutorials so I don't want to keep every gist in the index.html file but rather in the typescript file associated with each component if possible. Sorry if this is a repeat question, I just can't seem to find an easy answer for this.

Edit: To clarify, Angular doesn't allow tags in the html templates of each component, so I was wondering how one can embed gists, which come in the form of a script, in a component's typescript file.

TheSlugDev
  • 41
  • 4
  • 1
    Possible duplicate of [How do I embed a single file from a GitHub gist with the new gist interface?](https://stackoverflow.com/questions/14206307/how-do-i-embed-a-single-file-from-a-github-gist-with-the-new-gist-interface) – Fraser Mar 19 '18 at 23:40
  • I don't believe so, I'm asking how to wrap a gist in typescript or rather how to include it in Angular. That question is just asking how to edit the source in the script to only include a specific file in the gist. – TheSlugDev Mar 20 '18 at 00:02
  • sorry, it is just not very clear at all what it is you are asking - that question/answer is specifically about how to include an embedded gist - i.e. add a query string like ?file=myFile.blah – Fraser Mar 20 '18 at 01:02
  • Sorry, I'll try to clarify further. Angular doesn't allow – TheSlugDev Mar 20 '18 at 01:16

1 Answers1

0

To anyone still trying to do this, I found an excellent npm package on github that allows one to embed gists in Angular 4:

https://github.com/jasonhodges/ngx-gist

TheSlugDev
  • 41
  • 4