AngularJS : Access ng-repeat $index inside directive link function to access item in collection -
I have participated in a wall and no document thus far is not helping. I am trying to create an instruction that replaces an element with an iframe pointing to an external resource and every item in my array has a link to its resources
My data looks like this:
[["title": "launch", "name": "barbells", "resource": $ sce.trustAsResourceUrl (" Http: //external.domain: 14168 / bar / falcon ")}, {" title ":" launch "," name ":" fubar "," resource ": $ Sce.trustAsResourceUrl (" http: // external. Domain: 14168 / Foo / bar ")}];
My html looks like this:
& lt; Content element = "talk in things" & gt; & Lt; Iframe ng- src = "{{thing.resource}}" /> & Lt; / Luggage & gt;
My Director looks like this:
stuffsModule.directive ('stuffs', function ($ parse) {return {Limited: 'AE', transclue: 'element', replace: right, radius: correct, template: [' ul & gt;', ',' & lt; (''), Compile: function (Tilement, TATR, transcluse) {var rpt}, iframe / & gt; ',' , '& lt; / ul & gt; = Document.createAttribute ('ng-repeat'); rpt.value = tAttrs element [t] [0]. [0] .attributes.setNamedItem (rpt); return function (area, element, ether) {var rhs = Attr.element.s Plit ('in') [1]; scope.facilities = $ parse (rhs) (scope); var src = document.createAttribute ('ng-src'); src.value = scope.things [area. $ Parent. $ Index] .ourceource; // & lt; = Blown element [0] .children [0] .children [0] .attributes.setNamedItem ();}}}});
No matter what I do, scope. $ Parent Assesses $ index to undefined
Can anyone see the reason why I do not have access to the $ index in the linker function? Should I not be wired by NG-Repeat instructions, which I have added to the collection?
There is absolutely no response to your question but please see here I hope this will help you
app.directive ('stuffs', function ($ parse) {return {restrict:' ACE ',' element ', replace: correct, scope: true, template: ['
Comments
Post a Comment