I am working on laravel 5.3 with use of angular js. I have issue in Angular data display is when I passed ID in URL.
My URL like
http://localhost/demohotel/public/home/1359982
My Angular script code
<script>
var GroupsApp = angular.module('GroupsApp',[]);
GroupsApp.controller('GroupsController', function ($scope, GroupsService)
{
getGroups();
function getGroups() {
GroupsService.getGroups()
.success(function (grps) {
$scope.groups = grps;
console.log($scope.groups);
})
.error(function (error) {
$scope.status = 'Unable to load Product data: ' + error.message;
console.log($scope.status);
});
}
});
GroupsApp.factory('GroupsService', ['$http', function ($http) {
var GroupsService = {};
GroupsService.getGroups = function () {
return $http.get('showproduct');
};
return GroupsService;
}]);
</script>
Angluar data display code
<?php
$cat3 = DB::table('category')->get();
foreach($cat3 as $tt3)
{
?>
<div class="side-body padding-top" id="<?php echo ucfirst($tt3->id); ?>"><div ></div>
<h3 style="margin-top:0px; margin-bottom:0px;"><?php echo ucfirst($tt3->name); ?></h3>
<div class="row">
<div class="content2 mCustomScrollbar">
<div ng-if='r.category == <?php echo $tt3->id; ?>' ng-repeat = "r in groups | filter : searchGroups">
<div class="col-sm-12 pad0" style="margin-bottom:1px; margin-top:1px; padding-right:15px; ">
<div class="col-xs-2">
<a href="#"><img class="img-responsive" src="@" alt=""></a>
</div>
<div class="col-xs-6 pad0" style="padding-left:10px;">
<span class="tab pad0"> @</span>
</div>
<div class="col-xs-1" ng-if='r.type == 1'>
<img src="img/veg.jpg">
</div>
<div class="col-xs-1" ng-if='r.type == 2'>
<img src="img/nonveg.jpg">
</div>
<div class="col-xs-2 pad0" style="padding-top:5px;">
<span>Rs. @</span>
</div>
<div class="col-xs-1" ng-if='r.popup == 1' >
<a class="btn btn-primary btn-sm btn-sm1" href="#" data-id="@,@,@,@" style="margin-top:0px;">
<i class="glyphicon glyphicon-plus"></i></a>
</div>
<div class="col-xs-1" ng-if='r.popup == 0' >
<a class="btn btn-sm btn-primary btn-sm2" href="#" data-toggle="modal" data-target="#" data-id="@" style="margin-top:0px;">
<i class="glyphicon glyphicon-plus"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
but when I not passed Id in URL its working but I have to use ID in URL.please help to solve problem.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire