tommyd456 tommyd456 - 1 year ago 77
AngularJS Question

Gist-embed with Angular app

Trying to get 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 Source
(function($) {

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

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download