Here is my Javascript file
(function () {
var app = angular.module('app');
var controllerId = 'officium.incident.list';
app.controller(controllerId, [
'$scope', 'abp.services.incidentsystem.incident',
function ($scope, officiumService) {
var vm = this;
alert('ssssss')
officiumService.GetAllAssignedIncidents().success(function (data) {
vm.incidents = data.incidents;
});
}
]);
The alert I have is called when I load my webpage so I know the JS and webpage are linked correctly. I don't understand however why my 'GetAllAssignedIncidents' function isn't working. I have put a breakpoint on ther server for when this method is called but it never hits it meaning there may be something wrong with my JS or webpage?
<div class="panel panel-default" ng-controller="officium.incident.list as vm">
<div class="panel-heading" style="position: relative;">
<ul class="list-group" ng-repeat="incident in vm.incidents">
<div class="list-group-item">
<span ng-class="{'incident-description-active'">{{incident.IncidentDescription}}</span>
<br />
<span class="incident-assignedto">{{incident.LogID}}</span>
</div>
</ul>
</div>
My application service layer function.
public async Task<GetAllAssignedIncidentsOutput> GetAllAssignedIncidents()
{
var incidents = _incidentRepository.GetAllAssignedIncidents();
return new GetAllAssignedIncidentsOutput
{
Incidents = AutoMapper.Mapper.Map<List<IncidentDto>>(incidents)
};
}
API controller Builder code
public class OfficiumWebApiModule : AbpModule
{
public override void Initialize()
{
//This code is used to register classes to dependency injection system for this assembly using conventions.
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
//Creating dynamic Web Api Controllers for application services.
DynamicApiControllerBuilder
.ForAll<IApplicationService>(typeof(OfficiumApplicationModule).Assembly, "incidentsystem")
.Build();
}
abp.services.incidentsystem.incident
being passed to the controller function asofficumService
. so you really are callingabp.services.incidentsystem.incident.GetAllAssignedIncidents()
. does this function actually exist, and if it does, can you show it's code?