tommyd456 tommyd456 - 14 days ago 5
AngularJS Question

Gist-embed with Angular app

Trying to get gist-embed (https://github.com/blairvanderhoof/gist-embed) working within my Angular app but with no luck.

It works no problem on my homepage (which is not part of the Angular app) but when I use something like:

<code data-gist-id="<gist-id>"></code>


within the app it won't show. There are no messages in the console to explain why though.

Could someone explain why and offer a solution?

mpm mpm
Answer
(function($) {

  $(function() {
    // find all elements containing "data-gist-id" attribute.
    $('[data-gist-id]').each(function() {
      var $elem = $(this),
        id,

that lib is coded in such a way one cant really use it in angular,you'll have to look for a fork that offers a proper jquery plugin architecture you can use into a directive.That lib doesnt respect basic jQuery plugin architecture.

And no Error will show up because it's likely the .each will execute before your angular app runs.

Comments