Is there a way to activate ng-move following a splice operation?

I am currently using ng-animate in my project, where I have a list of entries displayed through ng-repeat. The issue I'm facing is that when I make a selection on one entry, it disappears from the list. I have properly defined the classes .ng-move, .ng-move-active, .ng-leave, and .ng-leave-active to handle animations for removing and reordering entries.

What I am trying to achieve is to trigger the .ng-move animation when an entry is removed, causing all other entries to slide up. However, I have noticed that the .splice() operation does not automatically trigger the .ng-move animation. Is there a way to force this animation to happen after a .splice()?

Below is the html code snippet:

<div data-ng-repeat="entry in data" class="container card-drop card-shift">
    <card data="entry"></card>
</div>

Here are the corresponding CSS classes:

.card-drop.ng-leave {
    transition: 0.5s ease-in-out;
    opacity: 1;
}

.card-drop.ng-leave.ng-leave-active {
    transform: scale(0.5);
    opacity: 0;
}

.card-shift.ng-move {
    transition: 0.5s ease-in-out;
}

.card-shift.ng-move.ng-move-active {
    transform: translateY(-284px);
}

In the JavaScript part of the code, the event triggering the concern is simply $scope.data.splice(index, 1);

EDIT: http://plnkr.co/edit/nz38XxPbV4Ycqdn3QYVP?p=preview

Above is the link to the plunk demonstrating the issue I am describing. When you click on an entry and it gets spliced, the .ng-leave animation is triggered but none of the ng-move animations occur.

Answer №1

After searching for a solution, I discovered that there was no simple way to achieve the desired outcome. I resorted to manipulating the CSS of DOM elements within the directive to create a sliding animation. This involved quickly returning them to their original position during the splice operation, producing the desired effect but in a somewhat unconventional manner.

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

SpyOn unit test for an Angular factory is not being utilized

I'm currently working on writing a unit test for an Angular factory: define([], function () { 'use strict'; var factoryName = 'UserFactory'; var components = ['ProductFactory', '$state']; var ...

Transmitting Several Pictures at Once Through WhatsApp-WebJS

I have encountered a challenge while attempting to send multiple images in a single WhatsApp message using the WhatsApp-WebJS library. Despite receiving a "success" confirmation without any errors, the images and message fail to appear on WhatsAp ...

`How to retrieve query parameters using the GET method in AngularJS`

I have created a REST API in WSO2 ESB. Below is the request service for the POST method: createUser: function(aUser) { var myCreateUserRequest = { "User": { "UserName": aUser.Username, ...

Unable to properly access required file path through HTML source

I have a confidential folder named 'inc' where I store sensitive files such as passwords in php connection files. This folder is located at the same level as the 'public_html' folder. I successfully accessed php files with database conn ...

The success function within the Ajax code is malfunctioning

I am currently utilizing express, node.js, and MySQL. The issue I am facing is that the success function inside my Ajax code is not working as expected. Below is the snippet of the Ajax code in question: function GetData_1(){ var state = $("#dpState_1"). ...

The THREE.MTLLoader fails to load the texture image

I have created a Three.js program that loads MTL and OBJ files and displays them on the scene. However, when I run the program, it shows no textures and the object appears black. I used MTL loader and OBJ loader and added the files to the root folder of m ...

Tips for effectively combining an array with jQuery.val

My goal is to have multiple form fields on a page, gather the input results into an array, and then store them in a database. This process was successful for me initially. However, when I introduced an autocomplete function which retrieves suggestions from ...

What is the best way to adjust star ratings in a database table after a page refresh using JavaScript?

I am looking to provide users with the ability to change the rating value of a product, but I'm encountering issues with it not working after the page is refreshed. For instance, a user can freely change the rating value of a new product multiple time ...

How can I prevent a block of white space from collapsing in CSS, without relying on the presence of a DIV element?

I am facing an issue with maintaining space above the Title in my design. The design includes elements like Title, Description, and Image. The challenge is to ensure that there is a 20px space above the Title, as shown in the example below: https://i.ssta ...

Encountering the error "Invalid URL. Please provide only absolute URLs" while trying to integrate the Airtable JavaScript library in a Next.js application

I am currently working on a Next JS application that includes a Page called somePage.js. In this page, I am attempting to make an XHR request to the Airtable API from within the getServerSideProps function. The relevant components look like this: pages/so ...

Displaying a distinct image for each Marker when hovering over them on a Map

I have implemented ReactMapGL as my Map component and I am using its HTMLOverlay feature to display a full-screen popup when hovering over markers. However, even though I have set different image data for each marker, all of them show the same image when h ...

Is it possible to use async/await together with forEach in JavaScript?

Within my array of objects containing user information and emails, I aim to send emails using AWS SES. To accomplish this, I must decide between utilizing await or normal .then. Preferably, I would like to use await within a forEach loop. Is it feasible to ...

What is the process of acquiring JSON and converting it into a JavaScript object array?

Can someone please assist me in converting the JSON generated in Spring Boot into a JavaScript object array? I'm currently facing some difficulties. https://i.stack.imgur.com/Tx5Ri.png I've been using XMLHttpRequest and my JS code is as follows ...

Dynamic user group system that leverages Ajax technology for seamless integration with an HTML interface, powered by PHP and

I am new to this, so please forgive my lack of knowledge. Currently, I am in the process of creating an Ajax-driven web application for managing user contact groups. This application allows users to store contacts based on assigned groups. Once a user con ...

Converting a string to an HTML object in Angular using Typescript and assigning it to a variable

I am facing an issue with passing HTML content from a service to a div element. I have a function that fetches HTML content as a string from a file and converts it into an HTML object, which I can see working in the console. However, when trying to assign ...

Creating random data in Vue is a fantastic way to enhance user

I'm attempting to retrieve a random quote from an API by generating a random index. However, when I click on the button associated with the index, I am not receiving a random quote as expected. Despite not encountering any obvious errors, the issue pe ...

A problem arises when utilizing jQuery's $.isArray functionality

Successfully executing an AJAX post, the function test is utilized to process the passed data. $("#formID").submit(function (event) { $('#postError').html('').hide(); $('#postInfo').html('loading results').s ...

Error: Unable to return callback response from NodeJs function

I have a function that handles the process of reading a private key from the filesystem and generating a JWT token. The code successfully reads the file and creates a token, but it encounters an issue when attempting to callback to the calling function. De ...

Inverted Scrolling Problem in Firefox

I am facing an issue with a script that inverts mouse movement for horizontal scrolling. It works fine in most browsers except Firefox. I could use some advice on how to troubleshoot this problem! $("body").mousewheel(function(event, delta) { ...

How can I use querySelector in JavaScript to target all div elements that have the same class?

I'm having an issue with the document.querySelector in my JavaScript code. It currently only selects the first div that contains the class "test", but I need it to select all such divs. Is there a way to achieve this using my existing JavaScript? ...