I am developing a web application with Angular as frond end and Laravel 5.2 as back end.
this is my laravel code.
Routes.php
Route::get('Aemployees',['uses'=>'AdminController@AngEmployeeList']);
AdminController.php
public function AngEmployeeList(){
return View::make('admin.angular.anguemployees');
}
View( anguemployees.blade.php)
@extends('admin.template')
@section('title', 'Angular Employees')
@section('content')
<div class="col-xs-12" ng-controller="Employees">
<section class="content-header">
<h1>Data Tables</h1>
<span><a href="{{URL::to(route('new_emp'))}}">Add new</a></span>
</section>
<div class="box">
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Mobile</th>
<th>Email</th>
<th>Updated At</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="employee in employees">
<td ng-bind="employee.emp_name"></td>
<td ng-bind="employee.emp_mobile"></td>
<td ng-bind="employee.emp_email"></td>
<td ng-bind="employee.updated_at"></td>
<td>
<span><a class="editThis" ng-click="edit(employee.pk_emp_id)"></a></span>
<span><a class="dltThis" ng-click="deleteItem(employee.pk_emp_id)"></a></span>
</td>
</tr>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
@endsection
Angularscripts.js
var EmployeeApp = angular.module('EmployeeApp',['ui.router']);
EmployeeApp.config(function($stateProvider,$urlRouteProvider){
$stateProvider.state('employees',{templateUrl : '/Aemployees'});
});
EmployeeApp.controller('Employees',function($scope,$http){
$http.get(BASEURL+'/getemployees')
.success(function(response){
$scope.employees = response;
});
$scope.deleteItem = function (item_id){
if(confirm("Are you sure want to delete ?") == true){
$http.post(BASEURL+'/deletemployees',{pk_id:item_id})
.success(function(response){
$scope.employees = response;
});
}
}
});
The Output is not working perfectly and getting an error in console.
How can I fix this issue ?
Is the any error in my code ?