AngularUi Mobile Modal List Display

I attempted to implement the code from 32400236/dynamically-generate-modals-with-mobileangularui but encountered issues. I also tried using the following:

<div class="access-item" ng-repeat="item in items track by $index">
 <a ui-turn-on="$index">Activate unique modal</a>
 <div ui-content-for="modals">
  <div class="modal modal-overlay" ui-if='$index' ui-state='$index'>
   ...

OR

<div class="access-item" ng-repeat="item in items track by $index">
 <a ui-turn-on="item.id">Activate unique modal</a>
 <div ui-content-for="modals">
  <div class="modal modal-overlay" ui-if='item.id' ui-state='item.id'>
   ...

However, only the last modal is displayed when activated.

Despite trying the approach suggested on 32400236/dynamically-generate-modals-with-mobileangularui, the designated function does not execute and no modal appears.

Is there a proper way to achieve this functionality?

Answer №1

There is only one model that is placed outside of the ng-repeat loop:

<div ui-content-for="modals">
        <div class="modal modal-overlay" ui-if='modal' ui-state='modal'>

Additionally, there is a ng-click function defined:

$scope.openModal = function (id) {
    var single_obj = $filter('filter')($scope.items, function (d) {return d.id === id;})[0];
    $scope.access = single_obj;
    SharedState.initialize($rootScope, 'modal'); 
    $rootScope.Ui.turnOn( 'modal' );
   }; 

This setup functions smoothly!

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

Utilizing JQuery to extract information from a JSON response

I've been struggling with accessing a specific piece of content within a JSON object. This is the code I'm using to fetch the data: function retrieveData(keyword){ $.ajax({ url: "https://openlibrary.org/api/books?bibkeys=ISBN ...

Is it possible to meta-refresh a page for redirection?

When creating a webpage, I included a META tag like this: <META http-equiv="refresh" content="5;URL=http://www.google.com"> The issue is that mobile browsers do not support this meta tag. It redirects properly on web browsers, but not on mobile dev ...

Tips on passing a variable into a controller using jQuery AJAX from the URL

Can you help me figure out how to pass an id to a function in the controller? I keep getting an error saying it cannot find the method in the controller. Here's my view: function Delete1(id) { if (confirm("Are you sure?")) { $. ...

When using multiple select tags with *ngFor in Angular, modifying the value of the first select tag will have an

<table id="DataTable" border="1" ALIGN="center"> <tr ALIGN="center"> <th>name</th> <th>address</th> <th>number</th> <th>type</th> </tr> <tr class="tcat" *ngFor ...

The custom layout in NestJS version 13 failed to display

I have implemented NextJs 13 in my project for building purposes. I am trying to use CustomLayout as the primary layout for my entire website. Even though there are no errors, I am facing an issue where the CustomLayout does not display as expected. ...

Merge JSON objects while retaining duplicate keys

I am looking to merge two arrays containing JSON objects while retaining duplicate keys by adding a prefix to the keys. In this specific scenario, the data from 'json2' is replacing the data from 'json1' due to having identical keys, bu ...

Adjusting image dynamically based on conditions

I need to dynamically display images on my HTML based on specific conditions using TypeScript. In my TypeScript file: styleArray = ["Solitary", "Visual","Auditory","Logical","Physical","Social","Verbal",]; constructor(){ for (var i = 0; this.sty ...

Manage an error request with unique parameters

I recently made a GET request using axios in my web application: axios({ method: 'get', url: "example.com", params:{ _id: "anId" } }) .th ...

Troubleshooting HTML/CSS and JavaScript Issues with Dropdown Menus

I'm having trouble getting my dropdown menu to work properly and I can't figure out why. The JavaScript code should toggle a class that hides the language options and slides up the other tabs like "Contact". However, when I click the button, noth ...

Transform JavaScript code to integrate with a pre-existing WebSocket within a React.js application

I have created a JavaScript code to establish connections with my own Ruby WebSocket server, where it waits for incoming messages, parses them, and then displays content based on certain conditions (the implementation details are not relevant at the moment ...

A solution for managing MUI data grid rows and columns using useRef to prevent infinite loops when handling onSortModelChange

I am encountering a similar issue as described in the question below. A suggestion was given to utilize useRef to encapsulate rows and columns and access its .current value. How can I implement this solution?? Material-UI Data Grid onSortModelChange Causi ...

Adding child arrays to a parent array in Angular 8 using push method

Upon filtering the data, the response obtained inside the findChildrens function is as follows: My expectation now is that if the object length of this.newRegion is greater than 1, then merge the children of the second object into the parent object's ...

How can you trigger a re-validation of a field within a form in AngularJS when a different value in the form has been altered?

I am facing an issue with a form that has a select and an input field which are interdependent for validation. The validation on the input field depends on the value selected in the select field. For instance, let's consider a scenario where the sele ...

Tips for managing state updates in React Redux

Currently, I am utilizing a reducer to manage the state in Redux. The current structure of my state is as follows: { activeConversation: "Jim" conversations: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}] user: {id: 8, username: &quo ...

What is the best way to incorporate data from a foreach method into a function call within an HTML string?

Having trouble calling a function with data from a foreach loop while generating HTML cards and buttons from an array. The issue seems to be in the renderProducts() method. /// <reference path="coin.ts" /> /// <reference path="prod ...

Troubleshooting intersecting objects in THREE.js

Having trouble detecting intersections of extruded objects in THREE.js. The objects are created from a 2D geometry as shown below: var geoShape = new THREE.Shape(vertexes); var geometry = new THREE.ExtrudeGeometry(geoShape, { bevelEnabled: false, amount: ...

Adjusting the input in a Textfield within React using Material UI

const [formData, setFormData] = useState({}); useEffect(() => { fetch("/formdata") .then((res) => res.json()) .then((data) => setFormData(data)); }, []); console.log("Form Data", formData); //Sorting by order let attr; ...

Percy snap shot test cannot be executed in Testcafe due to the error message: npm ERR! The script 'test:percy' is

For my initial test with percy snapshot, I used the command below: npm run test:percy Unfortunately, an error message appeared when running the command: xxx.xxx@LPG002572 TC-Visual % npm run test:percy npm ERR! missing script: test:percy npm ERR! A com ...

Angular ng-show does not seem to evaluate properly

After receiving the JSON array object below: "Tools": [ { "name": "Submit a Claim", "position": 1, "isOn": true, "alert": null }, { "name": "My Recurring Claims", "position": 2, "isOn": true, "alert": null }, { "name": "Online Enrollment ...

The issue of Angular 2.3.1 custom validator promise not resolving

I am currently working on implementing a sign up form in which I need to check if the username is already taken or not. To accomplish this, I have decided to use promises. The structure of my sign-up component is as follows: import { Component, OnInit } f ...