A simple and lightweight library for embedding GitHub Gists in your Angular applications.
- Embed all files from a GitHub gist
- Embed a single target file
- Auto-sized iframe
- Runs outside NgZone
Make sure to have iframe-resizer
installed. This library is needed for auto-resizing the iframe in which the gist is rendered.
npm install iframe-resizer
Install ngx-gist
npm install @ekkolon/ngx-gist
// app.module.ts import {NgxGistModule} from '@ekkolon/ngx-gist' export class AppModule { ... imports: [ ... NgxGistModule ] }
<!-- app.component.html --> ... <!-- Display all files --> <div class="my-awesome-gist-container"> <ngx-gist [gistId]="GIST_ID"></ngx-gist> </div> <!-- Display a specific file --> <div class="my-awesome-gist-container"> <ngx-gist [gistId]="GIST_ID" [file]="my-gist-file.ts"></ngx-gist> </div> ...
- iFrame Resizer This library is used to adjust the iframe's height automatically.