Below is a rewritten version of the text:"Vanishing dragged element issue in chrome with angular drag

I've been experimenting with the angular-drag-and-drop-lists library here in order to create a drag and drop list. However, I'm facing an issue where the dragged element disappears during the process. Unlike the demos where you can see the element being dragged around, it's not visible in my implementation below.

<div class="list-item"
     ng-repeat="item in items | filter:query"
     dnd-draggable="column"
     dnd-moved="items.splice($index, 1)"
     dnd-effect-allowed="move"
     dnd-selected="models.selected = item"
     ng-class="{'selected': models.selected === item}"
     draggable="true"
     >
     <div class="icon">
         <span class="some-button"></span>
     </div>
     <div class="title">
         {{item.title}}
     </div>
</div>

I have defined my css as follows:

.dndDragging:not(.dndDraggingSource) {
    display: block;
    background-color: red;
}
.dndDraggingSource {
    display: none;
}
.dndPlaceholder {
    background-color: #ddd;
}

While I am able to see the placeholder, I noticed that by adding random content inside the div, it shows up when dragged. But the original span and {{item.title}} contents don't display. This made me wonder if there's some specific manipulation needed on the data model for this functionality to work?

== Update ==

Upon further investigation, I discovered that the gibberish inside the div becomes visible when dragged, but the actual content provided through {{item.title}} remains hidden. Is there a step missing in order to properly handle the data model for this behavior to function as expected?

Answer №2

The issue here actually stemmed from a misunderstanding of the library's positioning requirements rather than the data model itself. Specifically, the dnd-list component requires all child elements to have relative positioning, but children tagged with ng-repeat and dndDraggable were using static positioning instead. This detail about static positioning was not immediately apparent.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to include input text along with a file upload in an AJAX request to upload.php? And how exactly would I go

How do I include the book name entered in the form field with id:bname in the request to be sent to the page upload.php, and how can I retrieve this text on the upload.php page? function uploadFile(){ var file = document.getElementById("upload"). ...

How can I trigger a drop-down menu to appear when an image is clicked on in the exact same location

As part of my website development project, I am working on a page that displays a list of customers in rows. Each customer row includes different fields such as priorities assigned by the MD and CEO. Depending on the priority value, an image is displayed. ...

Mastering the Art of Scrolling Down Content with Button Click in Ionic 3

I'm currently developing an Ionic chat application and I need the content to automatically scroll down when the user clicks on the send text button. You can see a visual representation of this in the images linked below. https://i.stack.imgur.com/gwR ...

The output of console.log in a browser context versus a code environment can vary

As I was building a carousel, I became completely lost with my HTML structure: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="Carousel.css&q ...

Which specific values could cause the function to fail?

I am considering implementing the function provided below: function removeDuplicates(array){ var output=[],object={}; for(var index=0,length=array.length;index<length;index++){ object[array[index]]=0; } for(index in object){ ...

The authentication for npm failed with a 401 error code when attempting to log in

When attempting to sign in to npm using the command npm login and providing my username, password, and email, I am encountering the following error message: The Registry is returning a 401 status code for the PUT request. Even though I have used the sa ...

ng-repeat isn't displaying the data

I have always been comfortable using the ng-repeat in Angular, but this time I seem to be facing a problem. I am trying to populate my DOM with data from a JSON file, but for some reason, the fields are not displaying as expected. Is there something wrong ...

What is the best way to include a component within a content-editable div in Vue.js?

Looking for the correct way to add a div inside a content-editable div on a click of a button in vue js. Here's the code I have been experimenting with: var ComponentClass = Vue.extend(AddTag) var instance = new ComponentClass({ propsData: { type: ...

What steps can be taken to fix the "connection Timeout" issue?

const axios = require('axios'); axios.get('https://encrypted.google.com/') .then((res) => { console.log("Status Code: ", res.status); console.log("Headers: ", res.headers); console.log("Data: ", res.data); }) .catc ...

Customize request / retrieve document cookies

I have successfully implemented a cookie in my express/node.js application. var express = require('express'); var cookieParser = require('cookie-parser') var app = express(); app.use(cookieParser()) app.use(function (req, res, next) ...

Is it possible for Node.js to not automatically restart the server when modifying .js files?

Right now I have node-supervisor set up to detect changes in .js files, and while it works well, I've realized that it restarts the server every time a js file is saved. Is there a way to save a server-side .js file without triggering a server restart ...

How can you create an event that is focused on options using Material-UI's Autocomplete feature?

This is regarding Material-UI's Autocomplete feature. I am looking for a way to track which autocomplete choice the user is currently focused on, whether it be through hovering over with the mouse or using keyboard arrows - before any actual selection ...

JSFiddle Functioning Properly, But Documents Are Not Loading

My JSFiddle is functioning properly, but the files on my computer aren't. It seems like there might be an issue with how they are linking up or something that I may have overlooked. I've checked the console for errors, but nothing is popping up. ...

Encountering an issue when attempting to construct the project: it asks for callback functions, but instead received an [

I'm currently facing an issue while trying to access a function that is crucial for updating some database values. Whenever I attempt to build the project, I encounter the following error: Error: Route.post() requires callback functions but got a [ ...

"Troubleshoot: Inadequate performance of table search in node.js due

Embarking on a journey of learning here excites me. I have an insatiable appetite for new knowledge! Grateful in advance for any assistance! Presenting a concise Node.js JavaScript code snippet of 30 lines for a standard table search process. The "table" ...

"Reposition all elements contained within a div that have a specific class

I'm completely new to Javascript and I've been trying to move all elements with a specific class inside a particular div. After doing some research, I found a solution that worked using IDs. However, when I tried to adapt it to work with classNam ...

What are the steps for sending a POST request with custom headers?

Currently, I am attempting to make a post request: For this request, I require a body that looks like this: { "listSearchFields": { "email": "sample" } } When testing this in Postman, it works fine. However, when trying to implement this code in ...

Which option offers better performance in Three.js: utilizing a sprite or a BufferedGeometry?

I am currently in the process of revamping an outdated visualization created a few years back using an earlier version of Three.js. The visualization consists of approximately 20,000 2D circles (nodes from a graph) displayed on a screen with predetermined ...

How to style numbers with spaces in angularjs dataTables

I am pulling my number field value from Firebase and inserting it into a table as shown below: <td><label>{{obj.mynumber}}</label></td> The values for mynumber look like this: 10 000 2 000 10 250 000 000 When I try to sort the ...

Sorting an array of arrays in AngularJS using different keys for each array

Is there a simple way to sort tabular data without pre-processing it into an array of objects in AngularJS? I have data coming from the server in the form of an array of arrays and an array of keys, and I need to be able to sort by a specific key. Here&ap ...