How to create dynamic transition effects in modal using AngularJS

My modal includes a next button for easy navigation.

Initially, the modal showcases content within:

<div ng-show="step1"></div>

Upon clicking the next button, the modal transitions to display different contents in 'step2' within the same modal.

The overall modal structure appears like this:

<div class="modal-body">

  <div ng-show="step1">
    This is step 1
  </div>

  <div ng-show="step2">
    This is step 2
  </div>

</div>
<div class="modal-footer">

  <button class="btn btn-primary" ng-click="next()" ng-show="step1">Next</button>
  <button class="btn btn-primary" ng-click="prev()" ng-show="step2">Previous</button>

</div>

I am looking to add some transition effects when the user clicks on the next button to provide a smoother switch between step contents. Any guidance on how to accomplish this would be greatly appreciated.

Plnkr available here: http://plnkr.co/edit/eWy6XA1U4GCWr1cK22hH

Answer №1

To ensure smooth animation transitions, make sure to include the ['ngAnimate'] dependency in your module. Then, add a specific class to your ng-show element and apply CSS styles using that class:

For an updated plunker demo, check out: http://plnkr.co/edit/PkdUxImq69s910etTy5U?p=preview

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

Setting the second tab as the primary active tab

I am currently working on a script that is well-known, and everything is functioning perfectly. However, I want to change it so that when the page is first opened, it displays the second tab instead of the first one (the first tab being a mail compose tab ...

Using loops in Sass mixins causes errors

I have been developing a SASS code to generate CSS output that has the following format. background: -webkit-linear-gradient(top, 50%); background: -moz-linear-gradient(top, 50%); background: linear-gradient(top, 50%); This is the SASS mixin code I cr ...

Tips for repositioning my sidebar using CSS and HTML

I'm a beginner in CSS and HTML and I'm struggling to make my sidebar move to the side on my website. I have divided my site into three div areas: one for the 'sidebar', one for the 'main content', and one for both called &apos ...

Tips for avoiding anti-aliasing of bitmap font on Internet Explorer and Firefox

I am currently experiencing issues with font smoothing when using a basic bitmap font for icons. While the font appears crisp in Chrome, it appears blurry in IE and FF. Do you have any recommendations on how to resolve this problem? You can view a screen ...

The collapse component from bootstrap is not visible due to an overlapping button

I am currently working on a responsive calendar featuring full-width buttons for events, accompanied by additional information displayed using the collapse component below. However, I am facing an issue where the button overlaps with other elements, preven ...

I am facing an issue where my Popover functions correctly when elements are added using HTML, but not when they are dynamically created

I'm currently working on a method to incorporate multiple popovers that have a similar appearance to the following: The screenshot of my first JsFiddle project (click to view) The initial progress I've made can be seen in my first JsFiddle, acc ...

Issue encountered while retrieving JWT

Currently, I am tackling the challenge of implementing JWT authentication using Angular and Java Jersey. I have successfully managed to send the JWT token from the server to the client, which can be observed as a POST response with a status code of 200 in ...

Displaying radio values in an Angular ng-repeat directive

I am new to Angular and facing difficulties in capturing the selected radio value when using ng-repeat. The documentation is a bit unclear on this matter. Any assistance or guidance would be highly appreciated. <div ng-repeat="item in ed"> <lab ...

In relation to the Uncaught Error: Syntax error, an unrecognized expression has been encountered

Recently, I started working on an AngularJS and Node.js application. It's all new to me. In the HTML page, I defined a link as <li><a data-toggle="modal" data-target="#myModal" href="/#/login">Login</a></li>, and then set up th ...

Is there a way for an input form to completely fill a table data cell without increasing the width of the entire row?

I would like to add a row of text inputs at the bottom of my table, with each input having the same size as the widest element in their respective rows. I have tried setting the width to 100%, but this ends up expanding the entire row, which is not the des ...

When the text is long, it does not extend all the way to the right

I am working on designing a login page and have created an input text field for the user's email address. However, I have noticed that when the email address is long, there is some space left at the end of the border (I suspect it may be due to paddin ...

Is it possible to automatically move text to the next line once it reaches a specific character limit using HTML/CSS/PHP?

Is there a way to handle text when it reaches the ceiling or exceeds a certain number of characters so that it goes to the next line instead of showing a scrollbar? I have a div element where I display text retrieved from a MySQL database, and sometimes th ...

Changing an AngularJS Protractor promise from a string to a decimal number - how to do it?

I am currently working with Angular.js Protractor to retrieve the values of cells in a grid. Although I can successfully retrieve these values, they are strings and I need to perform calculations with them. Upon attempting this: ptor.findElements(protrac ...

How can I duplicate or extract all the formatting applied to a specific text selection in Ckeditor?

I am currently utilizing CKEditor version 3.6 within my Asp.net MVC 3 Application. One of my tasks involves creating a Paint format option similar to Google Docs. I am looking to integrate this feature into CKEditor. Is there a way in CKEditor to transfe ...

Overrides of variables are not always complete

After setting up my project with npm install to utilize sass overrides, I encountered an issue. Despite adjusting the $theme-colors, only part of the page reflects the change. https://i.sstatic.net/xjrsx.png I attempted the following: $theme-colors: ("p ...

Using AngularJs to inject a service into a controller

I'm new to AngularJs and struggling with injecting a service into a controller in AngularJS. Despite reading numerous tutorials and topics on stackoverflow, I can't seem to resolve the issue due to both the controller and service using the same m ...

Issue: AngularJS not refreshing view after receiving server response

Currently, as I work on developing a mobile application, I've come across an issue related to relaying messages in the view after executing an ajax call and receiving data from the server. My goal is to display these messages to users only after they ...

AngularJS and the use of template tables

I need help creating an HTML table based on a specific model. Here is what I am trying to accomplish: Student | competence 1 | | subject 1 | subject 2| | exam 1 | exam2 | avera ...

Unable to render the ng-repeat child scope attribute

I am working on displaying a list of data records using ng-repeat. Each data object entry (referred to as a coupon) needs to have specific properties ($scope.etabName and $scope.etabDistance) extracted from it, calculations performed, and the results displ ...

Extensive content within the v-autocomplete field

I am trying to use the v-autocomplete component to display the entire text of the selected item. On initial selection, everything displays correctly: https://i.sstatic.net/LFZ2c.png However, once it is chosen, only a portion of the text is shown, leavin ...