"Angular Ionic combination for displaying lists with customized headers and footers on cards

My issue is fairly straightforward - I am looking to create a list card with item array from my controller. However, I am struggling with how to structure my data in the HTML. The list card should have a header, content, and footer. I have attempted various scenarios to input the data into the list card. Here is a snippet from my controller:

.controller("homeController", function ($scope, $http) {
        $scope.data = {};
 var diagramlink = 'http://fendypradana.com/alfalahkeu/Apifalah/infobayar/format/json';

            var processed_json = [], kategori = [],pembayaran_jumlah=[],sisa=[],jenisbayar_ket=[],statusbayar=[];
            $http.post(diagramlink, { user_id: 4 }).then(function (res) {
for (i = 0; i < res.data.data.length; i++) {
                    var dataint = parseInt(res.data.data[i].bayar_jumlah)
                    processed_json.push(dataint);
                    kategori.push(res.data.data[i].pembayaran_tanggal);
                    pembayaran_jumlah.push(res.data.data[i].pembayaran_jumlah);
                    sisa.push(res.data.data[i].sisa);
                    jenisbayar_ket.push(res.data.data[i].jenisbayar_ket);
                    statusbayar.push(res.data.data[i].statusbayar);

                }
                $scope.bayar_jumlah=processed_json
                $scope.pembayaran_tanggal=kategori
                $scope.pembayaran_jumlah=pembayaran_jumlah
                $scope.sisa=sisa
                $scope.jenisbayar_ket=jenisbayar_ket
                $scope.statusbayar=statusbayar
   })

    })

And here is my HTML:

<div class="item item-divider">
    {{stooge}}
</div>
<div class="item item-text-wrap" ng-repeat="tanggal in pembayaran_tanggal track by $index">
    {{tanggal}}
</div>
<div class="item item-divider" ng-repeat="status in statusbayar track by $index">
    {{status}}
</div>
            </div>

I have tried the above code, but it displays each data array in my list individually. My goal is to have each data item with its own header, content, and footer. Any suggestions would be greatly appreciated.

EDIT

I am aiming to structure my data in the list similar to the format shown in this example on Ionic Framework's documentation.

Answer №1

This statement must hold true

<div ng-repeat="tanggal in array.pembayaran_tanggal track by $index" style="margin-top:10px">
    <div class="item item-divider">
        Title
    </div>
    <div class="item item-text-wrap" >
        {{tanggal}}
    </div>
    <div class="item item-divider">
        {{array.statusbayar[$index]}}
    </div>
  </div>

Controller :

$scope.data = {};
$scope.array = {};
var diagramlink = 'http://fendypradana.com/alfalahkeu/Apifalah/infobayar/format/json';

        var processed_json = [], kategori = [],pembayaran_jumlah=[],sisa=[],jenisbayar_ket=[],statusbayar=[];
        $http.post(diagramlink, { user_id: 4 }).then(function (res) {
        for (i = 0; i < res.data.data.length; i++) {
                var dataint = parseInt(res.data.data[i].bayar_jumlah)
                processed_json.push(dataint);
                // processed_json.push(res.data.data[i].total);
                kategori.push(res.data.data[i].pembayaran_tanggal);
                pembayaran_jumlah.push(res.data.data[i].pembayaran_jumlah);
                sisa.push(res.data.data[i].sisa);
                jenisbayar_ket.push(res.data.data[i].jenisbayar_ket);
                statusbayar.push(res.data.data[i].statusbayar);

            }
            $scope.array.bayar_jumlah  = processed_json;
            $scope.array.pembayaran_tanggal = kategori;
            $scope.array.pembayaran_jumlah = pembayaran_jumlah;
            $scope.array.sisa = sisa;
            $scope.array.jenisbayar_ket = jenisbayar_ket;
            $scope.array.statusbayar = statusbayar;
   })

Codepen

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

Crushing jQuery's Sortable/Droppable

Having a little issue here. I want to be able to toggle the sortable plugin's behavior by clicking a button - basically switching between sort mode and view mode. I've attempted to achieve this with the following code: function enterSortMode(){ ...

angular-ui-tab-scroll: Odd spacing between blocks and tabs, each separated individually

Greetings! I would like to express my gratitude for this wonderful library! However, I am encountering an unusual issue when trying to wrap a tabset with tabs that are included separately. This can be done either by adding individual tab elements manually ...

Transferring data from a class method to a React component

Situation: In a React component, I have a class with its own methods that is instantiated. What I'm needing: One of the methods in the class changes the value of an input (referred to as `this.$el`) using `.val()`. However, I need to pass this value ...

I encountered an issue when attempting to execute an action as I received an error message indicating that the dispatch function was not

I just started learning about redux and I am trying to understand it from the basics. So, I installed an npm package and integrated it into my form. However, when I attempt to dispatch an action, I encounter an error stating that 'dispatch is not defi ...

I will evaluate two arrays of objects based on two distinct keys and then create a nested object that includes both parent and child elements

I'm currently facing an issue with comparing 2 arrays of objects and I couldn't find a suitable method in the lodash documentation. The challenge lies in comparing objects using different keys. private parentArray: {}[] = [ { Id: 1, Name: &ap ...

Retrieving Dropdown Value in Bootstrap 5: How to Obtain the Selected Item's Value from the Dropdown Button

I am having a slight issue with my dropdown button where I am trying to display the selected item as the value of the dropdown button. The Flag Icon and Text should be changing dynamically. I have tried some examples but it seems that it is not working as ...

The component briefly displays the previous state before updating in the Material-UI Alert component

Whenever there is an error from an API while a user is registering, an alert is displayed on the form page. To handle this, an Alert component was created: <Snackbar open={open} autoHideDuration={9000} onClose={() => { setOpen(f ...

Using Selenium: Checking for existing dropdown values and incrementing if necessary

I am currently working on automating an application using Selenium Webdriver with Java. The web application I am testing has an Add button that, when clicked, triggers the activation of a dropdown menu. Subsequent clicks on the Add button reveal additional ...

Error: Unable to access the 'location' property because it is undefined

Having trouble uploading a product along with an image using AWS S3 (Multer and MulterS3). Every time I try it in Postman, I get the error message "TypeError: Cannot read property 'location' of undefined" specifically pointing to the line where t ...

Run the jQuery script once it has been successfully loaded using jQuery's .load method

On the Index.html page, there is a select box labeled #choose_content_to_load and a div named #get_loaded_content <select id="choose_content_to_load"> <option>Some content from the page content.html and div #content</option> </select ...

Strategies for accessing array elements based on category

I am currently working with an array of diverse products var productList = [ { id: '1', category: 'todos', menuName: 'Empanada de Carne, Pollo o Mixta + Café 8oz.', menuPrice: '9.99&a ...

Using the fieldset element in AngularJS Material causes disruptions in my flex layout

My current issue can be illustrated through two code examples: The first example functions properly when the fieldset is not included. In the second example, including the fieldset causes the layout to extend beyond the window when there is long text (in ...

A guide on extracting JSON data from a script tag using Cheerio

I am in the process of extracting metadata from various websites. While utilizing Cheerio to retrieve elements like $('meta[property="article:published_time"]').attr('content') works smoothly for most sites, there are some whe ...

What is the best way to utilize props and mounted() in NuxtJS together?

I'm a beginner with NuxtJS and I'm looking to implement window.addEventListener on a specific component within my page. However, I also need to ensure that the event is removed when the page changes. In React, I would typically approach this as ...

Tips for merging two applications into a single file using Node.js

This code snippet represents the functionality of my chat application. var worker = function(worker) { var http = require('http'); var fs = require('fs'); var app = http.createServer(function(request, response) { f ...

CSS descendant selector add style excluding child elements

My issue involves two divs each containing a table. When I apply the CSS class "table" to the first div, the second table in the div is impacted as well. .tbl-generic th:nth-child(-n+2),td:nth-child(-n+2) { background-color:red; width:25px; } ...

What is the best way to resize a div located below a dynamic div in order to occupy the available space?

My website has a dynamic div1 and a scrollable table inside div2. I need the div2 to take up the remaining height of the window, while ensuring all divs remain responsive. I've tried using JavaScript to calculate and adjust the heights on window loa ...

Show temporary information on the user's side in a table

To better explain the issue, please refer to the accompanying image. I am working with a Master/Detail form, specifically a Bill of Materials, which involves storing data in two separate database tables. The top portion of the form (Product, Quantity) is ...

Experiencing a problem with Datatables where all columns are being grouped together in a single row

After creating a table with one row using colspan and adding my data to the next row, I encountered an issue with the datatables library. An error message appeared in the console: Uncaught TypeError: Cannot set property '_DT_CellIndex' of unde ...

Guide to autoplay an uploaded mp4 video in a flask application

I've been working on a Flask application that includes an upload button for videos in mp4 format. I'm facing an issue where after uploading a video, it only shows a generic grey screen without playing the video. I want to ensure that once a video ...