I want to send api call controller.js to service.js in my demo.i am show user list in demo and i am used for angularjs datatable with web api.and my structure is app.js,controller.js,service.js this 3 separate file is used. then i want to send call service.js.
this is my simple controller.js code working well.
app.controller('userscontroller', ['$scope', '$http', 'DTOptionsBuilder', 'DTColumnBuilder', 'userservice',
function ($scope, $http, DTOptionsBuilder, DTColumnBuilder, userservice) {
$scope.dtColumns = [
DTColumnBuilder.newColumn("fullName", "Full Name").withOption('name', 'firstname'),
DTColumnBuilder.newColumn("email", "Email").withOption('name', 'email'),
]
$scope.dtoptions = dtoptionsbuilder.newoptions().withoption('ajax', {
datasrc: "data",
url: "/home/getuserlist",
type: "post",
data: { 'type': "time"},
})
.withoption('processing', true)
.withoption('serverside', true)
.withpaginationtype('full_numbers')
.withdisplaylength(10)
.withoption('aasorting', [0, 'asc'])
}])
this my service.js file:
app.service('userservice', function ($http) {});
any one have idea how to call this api call using service.js then please let me know.