https://i.sstatic.net/S4ZtU.jpg
Hello there! I'm facing a challenge with Angular once again. Despite searching extensively on Google and in this forum, I haven't found a solution to my problem yet. Here's the issue:
Currently, I have a localhost setup, and our objective is to display a list of items in the field above the yellow "lanjutkan" button when the user clicks "tambahkan" (as shown in the image above). Essentially, we want the added items via the green button to appear in the field above "lanjutkan". Can anyone guide me on how to define and populate this data correctly?
Below are excerpts from the code:
Index.html (abbreviated for brevity)
<div class="container-customscroll">
<div class="content mCustomScrollbar">
<div class="itemcheck" ng-repeat="item in dataItem.stores | regex:'name':alfabet | orderBy: 'name' | filter: searchItem">
<div class="left" ng-if="item.preparation == ''" ng-model="name"><i class="fa fa-circle silver"></i>{{item.name}}</div>
<div class="right" ng-click="addToCart()"><a>+ Tambahkan</a> </div>
</div>
</div><!-- /mCustomScrollbar -->
</div><!-- /container-customscroll -->
<div class="col-md-4">
<div class="container-sidebaryellow">
<div class="title">Pemeriksaan Ditambahkan</div>
<div class="container-customscroll">
...
</div><!-- /content -->
<a href="#" class="btn btnyellow">Lanjutkan</a>
</div>
</div>
Angular code snippet:
var app = angular.module('pesanlab', []);
app.controller('pesanlabCtrl', function($scope,$http){
...
});
app.filter('regex', function() {
...
});
Additionally, I'm encountering issues related to CORS while integrating with an API based on Laravel 5.2 for backend operations. Any advice or assistance would be greatly appreciated.
Lastly, can someone assist me with debugging the following code that returns "undefined":
$scope.tambahItem = function(){
$scope.data = $scope.dataItem.stores;
$scope.temp = angular.fromJson($scope.data);
alert($scope.temp.name);
};
Your help in troubleshooting these challenges is highly valued. Thank you!