I need to duplicate the array list below
$scope.medicinelist = [
{medicine: 'AMLOPRES 5MG TABLET'},
{medicine: 'ARGIPREG SACHET'},
{medicine: 'ALCIPRO 500MG TABLET'} ,
{medicine: 'PROLOMET AM 50MG TABLET'},
{medicine: 'PROLOMET AM 5MG TABLET'},
{medicine: 'AB PHYLLINE 200MG TABLET SR'} ,
{medicine: 'ACIVIR 800MG TABLET DT'},
{medicine: 'CEPODEM AZ TABLET'},
{medicine: 'ECOSPRIN AV 10MG CAPSULE'},
{medicine: 'ECOSPRIN AV 150MG CAPSULE'} ,
{medicine: 'ATORLIP 40MG TABLET'},
{medicine: 'AMTAS 5MG TABLET'},
{medicine: 'ARKAMIN 100MG TABLET'} ,
{medicine: 'AMPOXIN 500MG INJECTION'} ];
and paste it into the following array list
$rootScope.medicinedrop = [
// {
// medicine: 'you try to drop me somewhere'
// }
];
I am also utilizing $scope.maedicinedrop for drag and drop functionality from another list. However, after copying, I seem to lose that capability as I can't drop items into it from another list anymore.
Upon clicking a button
$scope.copy = function(){
console.log($scope.pastprescription)
$scope.medicinedrop.unshift($scope.pastprescriptions.medicine);
}
But even after clicking the button, it appears blank. Although data is copied in the console, it's not being displayed.
For drag and drop operations, I am implementing dragular as follows:
dragularService([containerLeft_Medicine], {
containersModel: [$scope.allmedicines],
copy: true,
//move only from left to right
accepts: accepts
});
dragularService([containerRight_Medicine], {
containersModel: [$scope.medicinedrop],
removeOnSpill: true,
//move only from left to right
accepts: accepts
});
The ejs file for this operation looks like this:
<input class="form-control" type="text" ng-repeat="medicine_name in medicinedrop"
value="{{medicine_name.medicine}}" />