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.

4
  • 1
    Possible duplicate of How do I embed a single file from a GitHub gist with the new gist interface? Commented Mar 19, 2018 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. Commented Mar 20, 2018 at 0: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 Commented Mar 20, 2018 at 1:02
  • Sorry, I'll try to clarify further. Angular doesn't allow <script> 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. Does that make sense? Commented Mar 20, 2018 at 1:16

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

This package works with bugs of height. I faced scroll every time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.