I am using angular's scope.$last to add some jquery functionality to each element that was created after the ng-repeat directive. My custom directive detects the last element on my end but not on other's. The idea is to make html elements draggable. Need an extra pair of eyes to see what I'm doing wrong. Here is the code..
function myRepeatDirective($http, AuthService, $rootScope, $state){
return function(scope, element, attrs){
console.log('checking for scope.last');
if(scope.$last || scope.$parent.$last){
console.log('directive instantiated');
var draggables = []
var droppables = []
var tagModel = {
label: '',
productions: []
}
var controllerElement = document.querySelector('body');
var controllerScope = angular.element(controllerElement).scope();
draggables.push($('.draggable'))
draggables[0].each(function(){
$(this).draggable({
axis: 'y',
containment: 'parent',
snap: true,
snapMode: 'inner'
})
})
droppables.push($('.droppable'))
droppables[0].each(function(){
$(this).droppable({
drop: function(event,ui){
const tagData = {
productionId: '',
tagId: ''
}
via alonmatthew
No comments:
Post a Comment