-1
這裏是我的JavaScript文件AngularJS JavaScript函數沒有要求
(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;
});
}
]);
我有警報被稱爲當我加載我的網頁,所以我知道的JS和網頁的正確鏈接。但我不明白爲什麼我的'GetAllAssignedIncidents'函數不起作用。我在調用這個方法的時候在服務器上放了一個斷點,但它從來沒有打過它,這意味着我的JS或網頁可能有問題?
<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>
我的應用服務層功能。
public async Task<GetAllAssignedIncidentsOutput> GetAllAssignedIncidents()
{
var incidents = _incidentRepository.GetAllAssignedIncidents();
return new GetAllAssignedIncidentsOutput
{
Incidents = AutoMapper.Mapper.Map<List<IncidentDto>>(incidents)
};
}
API控制器Builder代碼
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();
}
你有你的語法錯誤的JavaScript,當加載頁面,右鍵 - 單擊檢查元素看到的錯誤在控制檯中。 –
你的代碼被寫入的方式,你有'abp.services.incidentsystem.incident'作爲'officumService'傳遞給控制器函數。所以你真的*正在調用'abp.services.incidentsystem.incident.GetAllAssignedIncidents()'。這個函數實際上是否存在,如果存在,你能顯示它的代碼嗎? – Claies
AS @Claies說過,你的服務是怎樣的?你在控制檯上的錯誤是什麼?你能分享這些東西嗎? –