javascript - How get attribute values in DOM elements with jquery, having a ng-repeat in angularJS -


I am very new with the angularJS, I have to figure out how to execute a jquery function that allows me to attract Is an SVG on the divisor of each image whose ID is "scoped" through its ng-repeat instructions.

partial.html

  & lt; Div class = "cover-per" ng-repeat = "project in projects" DV-list-projects & gt; & Lt; A href = "# / project / {{project.slug}}" & gt; & Lt; Div class = "cover" id = "{{project.slug}}" & gt; & Lt; Img ng-src = "{{project.custom_fields.projectCover}}" & gt; & Lt; / Div & gt; & Lt; / A & gt; & Lt; / Div & gt;   

My jquery function:

  $ ('. Cover'). Each (function (i, e) {var id = $ (this). Attr ('id'); var img = $ (this) .find ('img'). Attr ('src'); var iw = $ (This) .find ('img'). Width (); var ih = $ (This) .find ('img'). Height (); var drag = svg (id). Size (iw, ih); var SvgImg = draw.image (img). Size (iw, ih); svgImg .filter (function) {console.log ('filter'); add.colorMatrix ('saturate', 0.5);}) var polygon = Draw polygon ('0,0 '+ iw +', 0, '+ Ih); svgImg.clipWith (polygon);});   

So, I need to get the source, ID of .cover div, but I still like {{project.slug}} string, this scope for this ID Value of .

Hope you can give some excellent views about this argument.

Thank you.

To do this, the path of the angle is with the instructions, in context of the element jquery is directly assigned to its controller Instead of using it, the instructions give you the element.

  Module instructions ("myCover", function () {return {restricted: "A", replace: correct, scope: {project: "= myCover"}, template: "& lt ; Div class = 'cover' & gt; & lt; img ng -src = '{{project.custom_fields.projectCover}}' /> gt; & lt; / div & gt; ", link: function (scope, element , Etr) {// Find the image, you can modify it a bit more // that the instruction image im img = element.find ("img"); // handle when the image img.on ("load" to draw) Goes on; // Apply your manipulator function draw () {var iw = Img.width (); // log IC}}}});   

Then you can do this in your html

  & lt; Div my-cover = "project" />.   

You can find out more about the instructions and what does all this:

(sorry that this test has not happened or put in Bella Is, Quick Reply: & gt;)

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -