나는 전에 this question을 물었습니다. 그러나 제 질문은 JavaScript에서 직접 abp.services
메서드를 사용하는 것에 관한 것입니다.ASP.NET 웹 양식의 JavaScript에서 abp.services 사용
가정하자 내가 가진 :
public interface ISecurityAppService : IApplicationService
{
List<PacsUser_C_Extented> GetAll();
}
public class SecurityAppService : ApplicationService, ISecurityAppService
{
public List<PacsUser_C_Extented> GetAll()
{
// ...
return allUsers;
}
}
모든 보일러 서비스로 잘 등록됩니다
public class Global : AbpWebApplication<ImmenseWebModule>
{
protected override void Application_Start(object sender, EventArgs e)
{
base.Application_Start(sender, e);
}
}
ASP.NET Boilerplate
문서가 말했듯이, 당신을 자동 생성 서비스를 사용 할 수 있도록 귀하의 페이지에 필요한 스크립트를 포함해야합니다.
<script src="~/Abp/Framework/scripts/libs/angularjs/abp.ng.js"></script>
<script src="~/api/AbpServiceProxies/GetAll?type=angular"></script>
두 번째 줄은 angular
컨트롤러를 사용 말한다,하지만 난으로 변경 :
<script src="~/api/AbpServiceProxies/[email protected](Clock.Now.Ticks)">script>
... 아직 아무것도 작동하지 않습니다.
내가 ASP.NET 웹 폼의 자바 스크립트 코드에서 getAll
를 사용하려면
abp.service이
그래서 어떻게 getAll
사용할 수 있습니다
SecurityAppService
의 스크립트 요소
<script>...</script>
- 각도가 아닌가요?
미리 감사드립니다.
내가 각도 컨트롤러와 같은 MVC 부분보기 사용 업데이트
: 그 기능을 사용할 수 있어요(function() {
var app = angular.module('app');
var controllerId = 'sts.views.security.list';
app.controller(controllerId, [
'$scope', 'abp.services.remotesystem.security',
function ($scope, securityService) {
var vm = this;
vm.localize = abp.localization.getSource('ImmenseSystem');
vm.users = [];
vm.refreshUserList = function() {
abp.ui.setBusy(// Set whole page busy until getTasks completes
null,
securityService.getAll().success(function (data) {
vm.users = data;
abp.notify.info(vm.localize('UserListLoaded'));
})
);
};
vm.refreshUserList();
}
]);
})();
합니다. 그러나 ASP.NET Web Form 페이지의 JavaScript에서 사용하고 싶습니다.
'abp.service is not defined '→'abp.services'에서's'를 잊어 버렸습니까? – aaron
@arron 's'을 놓쳤다. 나는'abp.services'을 시도했다. – Aria
콘솔에 아무런 오류가 없지만 마침내 해결했다. – Aria