我一直在寻找过去4个小时的答案,并且通过收集多个记录,我已经完成了一些事情,但它没有正常工作。 我在哪里弄错了?
查看文件:
<?php
$payment_methods = DB::table('payment_methods')
->select('*')
->orderBy('created_at', 'desc')
->whereNull('deleted_at')
->get();
?>
<div style="margin-bottom:20px; display:inline-block;">
@foreach($payment_methods as $pm)
<div class=" pay-logo">
@if($pm->method_name != 'Cash on Delivery')
<label>
<img class="<% '{{$pm->method_name}}' == payment_method ? 'active' : '' %>" ng-click="selectPayment('{{$pm -> method_name}}')" src="/assets/marketplace/images/payment/{{$pm -> method_name}}.jpg" alt="" required>
<input style="visibility:hidden;" type="radio" name="payment_method" value="{{$pm->method_name}}" >
</label>
@endif
</div>
@endforeach
</div>
Angular JS代码:
$scope.selectPayment = function (payment_meth){
$http({
url: "/cart/getInfo?payment_value=" +$scope.payment_method, method: "GET",
}).success(function (paymentdata){
if (paymentdata != 'No Description Found'){
$scope.payment_value = paymentdata[0];
console.log($scope.payment_value.description);
}
}).error(function (e){
console.log(e);
});
}
答案 0 :(得分:1)
<img ng-class="{'active': '<% $pm→method_name %>' == payment_method}" ng-click="selectPayment('{{$pm -> method_name}}')" src="/assets/marketplace/images/payment/{{$pm -> method_name}}.jpg" alt="" required>