TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
BKS Saha
NA
44
18.7k
How to convert list to multidimensional array in angularjs?
Dec 6 2017 12:32 AM
function ($scope, $http) {
$scope.selectFaIndex = 0;
$scope.SelectedAvailItems = [];
$scope.SelectedSelectedListItems = [];
$scope.DefaultListItems = [
[]
];
$scope.SelectedListItems = [
[]
];
$scope.AvailableListItems = [
[]
];
AllListofMainDivisionDesignation();
function AllListofMainDivisionDesignation() {
$http.get("MainDivisionDesignationMap/AllListofMainDivisionDesignation").then(function (t) {
$scope.List = t.data;
var inputObj = t.data;
angular.forEach(inputObj, function (value, key) {
this.DefaultListItems.push(key.DesignationName + ':' + value.DesignationName);
}, $scope.DefaultListItems[$scope.selectFaIndex]);
});
}
angular.copy($scope.DefaultListItems, $scope.AvailableListItems);
alert($scope.AvailableListItems);
$scope.btnRight = function () {
angular.forEach($scope.SelectedAvailItems, function (value, key) {
this.push(value);
}, $scope.SelectedListItems[$scope.selectFaIndex]);
//remove the ones that were moved.
angular.forEach($scope.SelectedAvailItems, function (value, key) {
for (var i = $scope.AvailableListItems[$scope.selectFaIndex].length - 1; i >= 0; i--) {
if ($scope.AvailableListItems[$scope.selectFaIndex][i].DesignationName === value.DesignationName) {
$scope.AvailableListItems[$scope.selectFaIndex].splice(i, 1);
}
}
});
$scope.SelectedAvailItems = [];
};
$scope.btnLeft = function () {
//move selected.
angular.forEach($scope.SelectedSelectedListItems, function (value, key) {
this.push(value);
}, $scope.AvailableListItems[$scope.selectFaIndex]);
//remove the ones that were moved from the source container.
angular.forEach($scope.SelectedSelectedListItems, function (value, key) {
for (var i = $scope.SelectedListItems[$scope.selectFaIndex].length - 1; i >= 0; i--) {
if ($scope.SelectedListItems[$scope.selectFaIndex][i].DesignationName === value.DesignationName) {
$scope.SelectedListItems[$scope.selectFaIndex].splice(i, 1);
}
}
});
$scope.SelectedSelectedListItems = [];
};
});
});
Reply
Answers (
3
)
jquery and angular intraction
How to create Api in Asp.net core Using SignalR for angular