Plugin doesn't work within Angular ng-repeat directive
See original GitHub issue //Magnific-popup
$(‘.single-popup’).magnificPopup({ type: ‘image’, removalDelay: 300, mainClass: ‘mfp-with-fade’, closeOnContentClick: true });
An example from the site copied/pasted works fine, however anything with a databinded href value that is pathed via ‘…/’ does not work. Instead it routes my site to the home page. There are no additional functions on the images not working.
The code
Issue Analytics
- State:
- Created 9 years ago
- Comments:11
Top Results From Across the Web
Jquery plugin not working inside AngularJS ng-repeat
I'm trying to use a Jquery plugin (Star Rating plugin - link) inside AngularJS's ng-repeat directive but I dont know why its not...
Read more >Top 18 Most Common AngularJS Developer Mistakes - Toptal
In this article you will learn about most common AngularJS developer ... Many directives create child scopes such as ngRepeat , ngIf ,...
Read more >ngRepeat - AngularJS: API
The ngRepeat directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop...
Read more >AngularJS: ng-repeat list is not updated when a model ...
<div ng-repeat="pluginD in pluginsDisplayed"> <div k2plugin pluginname="{{pluginD.name}}" ... Could you explain me why this doesn't work?
Read more >directive : ng-repeat before call jquery plugin (using transclude ?)
I tried by compiling myself and using $apply() before I call the plugin. It works but angularjs thow an exception on $apply() saying...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Dear friend!
I need some help, please ask a couple of simple questions regarding my new article, here they are http://personal.thetootclassic.com/e4vxck
chris
Hi @Bradmartin0905, thank you for posting this issue, as it clarified a few problems I was having with my own AngularJS app. I’m suffering from the same problem with ng-repeat and found a workaround that I thought I would share with you until this is resolved. Many jQuery plugins don’t work with dynamically generated DOM elements (like ng-repeat). I suggest using some sort of $watch along with a $timeout to check when the ng-repeat is loaded, then you initialize magnific-popup.
This isn’t the most elegant solution, but I’m sure it can be improved with time. Good luck figuring it out and hope this helps! I should note, just make sure to have your gallery (or whatever you choose to call it) class outside of the ng-repeat div.