This is the scenario.
I have a Directive in my Html
<div class="row xsResponse" id="productGrid">
<product product="product" ng-repeat="product in products"></product>
</div>
that product something like that
<div class="product">
<!-- ... -->
</div>
and in the same page i have a Javascript that have to reference all the .product (class) in the #productGrid like this
document.querySelectorAll( '#productGrid .product' )).forEach( function( el ) {
//.......
}
The problem is that the Javascript can see only the <product ...></product>
tag and not his production.
There is a way to call the Javascript after the ng-repeat?
Sorry if the question can appear not so clean and sorry for my bad english. Thanks for all your suggestions.
EDIT
For clarifications, here there is the javascript code.
<script>
(function() {
var body = document.body,
dropArea = document.getElementById( 'drop-area' ),
droppableArr = [], dropAreaTimeout;
// initialize droppables
[].slice.call( document.querySelectorAll( '#drop-area .drop-area__item' )).forEach( function( el ) {
droppableArr.push( new Droppable( el, {
onDrop : function( instance, draggableEl ) {
// show checkmark inside the droppabe element
classie.add( instance.el, 'drop-feedback' );
clearTimeout( instance.checkmarkTimeout );
instance.checkmarkTimeout = setTimeout( function() {
classie.remove( instance.el, 'drop-feedback' );
}, 800 );
// ...
}
} ) );
} );
// initialize draggable(s)
[].slice.call(document.querySelectorAll( '#grid .product' )).forEach( function( el ) {
new Draggable( el, droppableArr, {
draggabilly : { containment: document.body },
onStart : function() {
// clear timeout: dropAreaTimeout (toggle drop area)
clearTimeout( dropAreaTimeout );
// show dropArea
classie.add( dropArea, 'show' );
},
onEnd : function( wasDropped ) {
var afterDropFn = function() {
// hide dropArea
classie.remove( dropArea, 'show' );
};
if( !wasDropped ) {
afterDropFn();
}
else {
// after some time hide drop area and remove class 'drag-active' from body
clearTimeout( dropAreaTimeout );
dropAreaTimeout = setTimeout( afterDropFn, 400 );
}
}
} );
} );
})();
</script>