Increase visibility, decrease visibility by utilizing ng-hide/ng-show and functions

As I implement the show more/show less feature, I am uncertain if achieving a smooth effect is feasible. However, I believe it's worth reaching out to this community for some creative ideas on how to make it possible.

I have a list of dynamic links with a fixed limit of 5. When clicked, the number increases and determines whether certain sections are displayed or hidden using ng-hide/ng-show.

My goal is to create a seamless transition when clicking the show more or show less links, making the effect elegant and not too abrupt.

Links markup:

<ul class="precall-journal-links">

    <li ng-repeat="fact in pc.historyRecords | limitTo:pc.limit" style="list-style-type: none; margin: 5px 0;">

        <a style="color: #345bab;" ng-click="pc.load_history_record(fact.dump.PreCallID); ">{{fact.dump.PrimaryKeyName}}:{{fact.dump.PreCallID}}
            _Date:{{fact.dump.MeetingDate}}
            _Time:{{fact.dump.MeetingTime}}
            _Location:{{fact.dump.MeetingLocation}}
        </a>

    </li>

</ul>

Show more/show less markup:

<div class="arrows" style="position: relative; top: 2px; left: 40px;">

    <div ng-hide="pc.historyRecords.length <= pc.limit">
        <a style="position: relative; bottom: 5px; color: #3e4c67;" ng-click="pc.increaseItemCount()">See More <i class="fa fa-arrow-down"></i></a>
    </div>

    <div ng-hide="(pc.limit === 5)||(pc.historyRecords.length <= 5)">
        <a style="position: relative; bottom: 5px; color: #3e4c67;" ng-click="pc.decreaseItemCount()">See Less <i class="fa fa-arrow-up"></i></a>
    </div>

</div>

Javascript to increase/decrease limit:

vm.limit = 5;
vm.increaseItemCount = function (item) {
    vm.limit = vm.limit + 5;
};
vm.decreaseItemCount = function (item) {
    if (vm.limit > 0) {
        vm.limit = vm.limit - 5;
    }
};

Answer №2

Have you experimented with ngAnimate?

Check it out, I believe that's precisely what you need.

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

To access the link, simply click once if there is no child menu. However, if there is a child menu attached, be sure to click

I am working on a mobile menu that is designed to slide out when clicked. Currently, the parent pages are displayed by default. I want to implement functionality where if a parent page has child pages, clicking on it will slide down the sub menu. If click ...

Create a rectangular container with text using CSS

Looking to achieve a square box design using CSS with specific dimensions? Want to insert text inside the square and ensure it is horizontally centered within the square? Check out this code snippet: #myid { width: 100px; height: 100px; ...

"Want to learn how to dynamically disable an input field in AngularJS when another field is selected? Find out how to achieve this using the

Hey there, I'm dealing with two input fields. Input field A is a drop-down menu and input field B. They both have the same value (same ng-model). My goal is to clear the second input field whenever the user selects an option from the dropdown. Can any ...

Crafting visually stunning interfaces with Material UI

I'm a beginner in Material Design and I could use some assistance with the following structure. Can anyone guide me on how to create this? https://i.stack.imgur.com/NpiVz.png I've managed to add a text box, but now I'd like to place a label ...

Three.js: Comparing the Process of Updating Geometries with Replacing Them

In my current project, I have a complex scene filled with objects created using the ExtrudeGeometry method. These objects need to be updated every frame, with the extrusion shape and amount constantly changing. The shapes are generated using d3's voro ...

After clicking the submit button, make sure to automatically fill in all empty input fields

I am currently working on a form that includes various input types such as text fields, radio buttons, select dropdowns, and text areas. The form is displayed in a table format with an option to add additional rows. One issue I have encountered is that us ...

What is the best way to locate the position of a different element within ReactJS?

Within my parent element, I have two child elements. The second child has the capability to be dragged into the first child. Upon successful drag and drop into the first child, a callback function will be triggered. What is the best way for me to determi ...

Exploring the fundamentals of Express.js code base

I have been examining the express.js code and attempting to rewrite it to gain a better understanding of creating middlewares within a framework. However, the complex inheritance structure in the code is causing confusion for me. Here are some relevant co ...

The ng-bind-html-untrusted directive does not seem to be functioning properly within the tabset component of Angular

I am facing an issue where I am unable to display HTML output with a tabset attribute. Despite this, other HTML code is functioning correctly: <tabset> <tab heading="Canada"></tab> <tab heading="International"> </tab> <tab ...

Creating a Date Computation Tool that Adds Additional Days to a Given Date

I have a challenge where Date 0 represents the start date, Date 1 is the result date after adding a certain number of days (NDays). I am looking for help in JavaScript to calculate Date0 + NDays = Date1. Please assist me as my coding knowledge is quite l ...

Removing an event from Fullcalendar

With the help of a post on StackOverflow, I managed to modify my select: method to prevent users from adding an event on a date before NOW. However, there is a drawback. When a user clicks on an empty time slot and the system displays an alert message, th ...

Discover the seamless integration of using Angular UI select2 with Angular 1.2.5 for a smooth user

I am attempting to make this jsfiddle compatible with angular 1.2.5 instead of just 1.0.5. http://jsfiddle.net/hWXBv/25/ <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script> The goal is to create a Gmail-lik ...

How can I ensure that Redux-saga waits for API calls to resolve instead of returning promises continuously? Is there a way to make "yield call" wait for API calls to complete?

Where I'm initiating the API request: function fetchCharacter(value){ return axios.get(`https://www.breakingbadapi.com/api/characters?name=${value}`) .then(res=>{ console.log(res.data) }) .cat ...

Looking for insights on reading and presenting XML files from a URL? Learn how to achieve this effortlessly with the power

Currently, I'm in the process of developing an innovative Android application using PhoneGap. My main objective is to dynamically present the data stored within a customized XML file hosted on my website that follows the .php format. Do you happen to ...

Tips for halting the live graph plotting based on a specific condition with canvas js

I have a piece of code that generates a live graph based on probabilities. I am looking for a way to stop the plotting process as soon as a specific condition is met. <script> window.onload = function () { var dps = []; // dataPoints var c ...

Refreshing HTML Form upon Submit using JavaScript

I've been searching through various discussions without any luck, but I'm encountering an issue with a form that successfully submits data to a Google Sheet, yet the input fields retain their content after submission. Here is the code: <form ...

Troubleshooting a problem with data retrieval in Hygraph and Next JS

I'm currently facing an issue while attempting to fetch data from Hygraph in a fresh Next JS application. The error message I'm encountering is: Error: Cannot read properties of undefined (reading 'map'). As a beginner in both technolo ...

How to use jQuery to highlight the parent element when clicking on a child element?

I'm struggling with some HTML code that looks like the following: <ul> <li class="curent"><a href="home.html">Home</a></li> <li> <a href="javascript:void(0)">Products</a> <ul ...

Displaying various results using a range slider

I really need some assistance in making this range slider produce multiple outputs. I've attempted a few different options, but unfortunately, I haven't been able to figure it out. My goal is to have the text "590" display as 5.9 times the value ...

most effective method for establishing a relationship between a variable and its corresponding identification number

When retrieving results from a database with a simple PHP while loop, one of the data pieces includes a number that links to another table where the corresponding value is stored. While there are various ways to link this information and display the relate ...