Rinat Hatipov Rinat Hatipov - 1 year ago 71
AngularJS Question

Angular, how to do list in allert

I want to make a list of people's names in the pop-up window, when you drag the block. I got a list of users, but do not know how to make the list, please help.

My Angular Module and Controller

var app = angular.module('DentalEthereumApp', ['ngMaterial', 'ngDraggable']);
app.controller('MainCtrl', function ($scope) {
$scope.cad_users = [];
var modes = ["doctor","delivery","digitize","cad","mill","patient"];
function guys(mode_index) {
url: "/"+modes[mode_index]+"_users",
dataType: 'json',
success: function(result){
$scope.current_guys = result;

var mill_users = [];
var design_users = [];
var digitize_users = [];
var doctor_users = [];
var patient_users = [];

$scope.positions = [];
$scope.current_guys = [];
$scope.centerAnchor = true;
$scope.toggleCenterAnchor = function () {
$scope.centerAnchor = !$scope.centerAnchor
$scope.Math = Math;
var modes = ["doctor","delivery","digitize","cad","mill","patient"];
$scope.parts = ["doctor","delivery","digitize","cad","mill","patient"];
$scope.angles = [-60,0,60,120,180,240,300];
$scope.centerX_lg = 400;
$scope.centerY_lg = 270;
$scope.radius_lg = 250;
$scope.lists = [[{name: 'Заказ 1'}, {name: 'Заказ 2'},{name: 'Заказ 3'},{name: 'Заказ 4'},{name: 'Заказ 5'},{name: 'Заказ 6'},{name: 'Заказ 7'}],[],[],[],[],[]];
$scope.dropSuccess = function(index,listData,event){
var obj = {data: listData,mode: $scope.parts[index]};
//!!!!Ethereum action
$scope.dragSuccess = function(index,listData,event){
var indexDel= $scope.lists[index].indexOf(listData);
if (indexDel>-1) {

My view, html doc

<div id="contract">
<table width="100%">
<tr ng-repeat="position in positions">
<div ng-repeat="index in [0,1,2,3,4,5]">
<div style="position:absolute;
width:200px; height:200px; border-radius:10%;
top: {{centerY_lg+Math.floor(radius_lg*Math.sin(3.14*angles[index]/180))}}px;
" ng-drop="true" ng-drop-success="dropSuccess(index,$data,$event)">

<h3 style="position:absolute;top:2px;">{{parts[index]}}</h3>

<div class="ng-drag" ng-repeat="listItem in lists[index]" ng-drag="true" ng-drag-data="listItem" ng-drag-success="dragSuccess(index,$data,$event)">

<div class="contract">
<md-button ng-click="checkBalance()">

When I drag, I get a pop-up window, but need an ordered list of names

I have this

Answer Source

Inside the success:

You need to loop trough the results and return only the attributes you need. Here's an example.

var names = "";
result.forEach(function(object, index, array) {
  names =+ " " + object.name;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download