i'm trying to ad a new entity to the SimpleTaskSystem example project
in order to add a "car" entity and everything it needs to be displayed i did exactly this till now:
- create the "car" entity
- create the a new repositoty for the new entity
- create the ApplicationLayer a dn relative DTOs + input/output objects
- create views and relative angulars'controller file
at this poin i got this error into the browser consolle:
Error: [$injector:unpr] http://errors.angularjs.org/1.3.8/$injector/unpr?p0=abp.services.tasksystem.carProvider%20%3C-%20abp.services.tasksystem.car%20%3C-%20sts.views.car.list
at Anonymous function (http://localhost:6247/Scripts/angular.min.js:38:301)
i suppose the problem is the name of the angular services that i used in my angular controller (in my case 'abp.services.tasksystem.car') the question is:
- is this angular service autogenerated?
- is the naming convention (that i used) correct supposing that i have an ApplicationLayer that is named "CarAppServices" and has a method named "GetFreeCarsOutput"
- did i miss something after the point "4"? did i have to add something else other than view and controller?
THE APPLICATION LAYER
public class CarAppServices : ApplicationService, ICarAppServices
{
private readonly ICarRepository _carRepository;
private readonly IRepository<Person> _personRepository;
public CarAppServices(ICarRepository carRepository, IRepository<Person> personRepository)
{
_carRepository = carRepository;
_personRepository = personRepository;
}
public GetFreeCarsOutput GetFreeCars(GetFreeCarsInput input)
{
var cars = _carRepository.GetAllFreeCars(input.MaxSpeed);
return new GetFreeCarsOutput
{
Cars = Mapper.Map<List<CarDto>>(cars)
};
}
}
THE ANGULAR CONTROLLER
(function() {
var app = angular.module('app');
var controllerId = 'sts.views.car.list';
app.controller(controllerId, [
'$scope', 'abp.services.tasksystem.car',
function($scope, carService) {
var vm = this;
.....
....
...
..
.
var myCars = carService.getAllFreeCars({
.....
....
...
..
.
18 Answer(s)
-
0
Hi,
Try renaming ICarAppServices to ICarAppService and CarAppServices to CarAppService. From the documentation (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API">http://www.aspnetboilerplate.com/Pages/ ... ic-Web-API</a>):
"To calculate service name: Service and AppService postfixes and I prefix is removed (for interfaces). Also, service name is converted to camel case."
You can see all generated services by this URL: ~/api/AbpServiceProxies/GetAll?type=angular
-
0
i also have same error i have an ImemberprofileAppService interface and memberProfileAppService class files
the above two files present in application in MemberProfiles folder
i used this in .js file
abp.services.tasksystem.memberprofile
i have the following coding in webapi
DynamicApiControllerBuilder .ForAll<IApplicationService>(Assembly.GetAssembly(typeof(MYVEOApplicationModule)), "tasksystem") .Build();
what is the service name in this case please give an answer....???? please
-
0
Hi,
Have you open the URL .../api/AbpServiceProxies/GetAll ? You can see names of your services here.
-
0
sir i have use this script in my html page..!! but same problem..
<script src="/api/AbpServiceProxies/GetAll" type="text/javascript"></script> and <script src="/api/AbpServiceProxies/Get?name=tasksystem/task" type="text/javascript"></script>
-
0
sir i had send you all my coding part to you in your first to learn forum article please help me out sir
-
0
ImemberprofileAppService code
namespace MYVEO.MemberProfiles { public interface ImemberprofileAppService:IApplicationService { GetTasksOutput GetTasks(GetTasksInput input); void UpdateTask(UpdateTaskInput input); void CreateTask(CreateTaskInput input); } }
memberprofileAppService code
namespace MYVEO.MemberProfiles { public class memberprofileAppService : ApplicationService, ImemberprofileAppService { private ImemberprofileRepository _taskRepository; /// <summary> ///In constructor, we can get needed classes/interfaces. ///They are sent here by dependency injection system automatically. /// </summary> public memberprofileAppService(ImemberprofileRepository taskRepository) { _taskRepository = taskRepository; } public GetTasksOutput GetTasks(GetTasksInput input) { //Called specific GetAllWithPeople method of task repository. var tasks = _taskRepository.memberGetAll(); //Used AutoMapper to automatically convert List<Task> to List<TaskDto>. return new GetTasksOutput { //Tasks = Mapper.Map<List<MemberProfilesDtos>>(tasks) }; } public void UpdateTask(UpdateTaskInput input) { } public void CreateTask(CreateTaskInput input) { // Logger.Info("Creating a task for input: " + input); var tasks = new memberprofile { MemberCode=input.MemberCode, Firstname=input.Firstname, Lastname=input.Lastname, MiddleInitial=input.MiddleInitial, Additional=input.MiddleInitial, DOB=input.DOB, Email=input.Email, PhoneNo=input.PhoneNo, Extension=input.Extension }; _taskRepository.Insert(tasks); } }
Coding in webapi
DynamicApiControllerBuilder .ForAll<IApplicationService>(Assembly.GetAssembly(typeof(MYVEOApplicationModule)), "tasksystem") .Build();
Javascript code
(function () { var app = angular.module('app'); var controllerId = 'insertcontroller'; app.controller(controllerId, [ '$scope', '$location', 'abp.services.tasksystem.memberprofile', function ($scope, $location,memberprofileService) { var vm = this; vm.tasks = { Membercode:'', FirstName:'', Lastname:'', MiddleInitial:'', Additional:'', DOB:null, Email:'', PhoneNo:'', Extension:'' }; var localize = abp.localization.getSource('MYVEO'); vm.saveTask = function() { abp.ui.setBusy( null, memberprofileService.createTask( vm.tasks ).success(function() { //abp.notify.info(abp.utils.formatString(localize("TaskCreatedMessage"), vm.task.description)); $location.path('/'); }) ); }; } ]); })();
html page coding
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <div class="container" style="margin-bottom:4px; border:5px outset; border-color:#e1e1e1" ng-controller="insertcontroller as vm"> <div class="col-md-12"> <div class="profile_bg"> <h4 style="font-size:larger"><b>Member Profile</b></h4> <div class="col-md-12"> <div class="col-md-5"> <span>MemberCode*</span> </div> <div class="col-md-5"> <input id="txtMemberCode" type="text" ng-model="vm.tasks.Membercode" /> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>First Name *</span> </div> <div class="col-md-5"> <input id="txtFirstName" type="text" ng-model="vm.tasks.FirstName" /> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>Last Name</span> </div> <div class="col-md-5"> <input id="txtLastName" type="text" ng-model="vm.tasks.Lastname" /> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>Middle Initial</span> </div> <div class="col-md-5"> <input id="txtMiddle" type="text" ng-model="vm.tasks.MiddleInitial" /> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>Additional</span> </div> <div class="col-md-5"> <textarea id="TextArea1" rows="2" cols="20" ng-model="vm.tasks.Additional"></textarea> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>Date Of Birth*</span> </div> <div class="col-md-5"> <input id="txtDOB" type="text" ng-model="vm.tasks.DOB" /> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>Email *</span> </div> <div class="col-md-5"> <input id="txtEmail" type="text" ng-model="vm.tasks.Email" /> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>Contact Number*<span style="color: #00629F">(Ex-987-666-4323)</span></span> </div> <div class="col-md-5"> <input id="txtContactNo" type="text" maxlength="12" ng-model="vm.tasks.PhoneNo" /> </div> </div> <div class="col-md-12"> <div class="col-md-5"> <span>Extension</span> </div> <div class="col-md-5"> <input id="Text1" type="text" ng-model="vm.tasks.Extension" /> </div> </div> <div class="col-md-12"> </div> <div class="col-md-5"> </div> <button ng-click="vm.saveTask()"type="submit">INSERT</button> </div> </div> </div> <script src="/api/AbpServiceProxies/GetAll" type="text/javascript"></script> <script src="/api/AbpServiceProxies/Get?name=tasksystem/task" type="text/javascript"></script> </body> </html>
error
Error: [$injector:unpr] http://errors.angularjs.org/1.3.15/$injector/unpr?p0=abp.services.tasksystem.memberprofileProvider%20%3C-%20abp.services.tasksystem.memberprofile%20%3C- 0nsertcontroller
please help me out sir waiting for reply thank you
-
0
OK, but please just open .../api/AbpServiceProxies/GetAll?type=angular in your browser and paste the contents here.
It will be similar like that: <a class="postlink" href="http://qasample.aspnetboilerplate.com/api/AbpServiceProxies/GetAll?type=angular">http://qasample.aspnetboilerplate.com/a ... pe=angular</a>
-
0
sir after opening following link in my browser its blank page...??? now what the next step to work it out..???
<a class="postlink" href="http://localhost:6234/api/AbpServiceProxies/GetAll?type=angular">http://localhost:6234/api/AbpServicePro ... pe=angular</a>
please reply thank you
-
0
That's strange.. Can you debug to see if this code is called:
DynamicApiControllerBuilder .ForAll<IApplicationService>(Assembly.GetAssembly(typeof(MYVEOApplicationModule)), "tasksystem") .Build();
??? How did you created your project? With the templates?
-
0
yes sir i have created project with template and also check by debug the code..
-
0
yes sir i used a template ...
-
0
At this point, the only thing I can is that: zip and send me your project, I will try it myself. Is that possible?
-
0
sir want to know your email id...???
thank you so much sir for your support
-
0
internal error occurs during your request means ...???
please reply.. thank you
-
0
It means a server side error happen and it's hided from end user. You can see Logs folder of Web project. For more information, please read the Exception Handling doc: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Handling-Exceptions">http://www.aspnetboilerplate.com/Pages/ ... Exceptions</a>
-
0
thank you sir for all your support and guidance
i want to know the use of Get() method in boilerplate ...??? I am using it but getting error may i know the the important points to remember for use of Get() method ..??
-
0
I am getting errors from autogenerated webAPI. Here is the content after hitting that url: ../api/AbpServiceProxies/GetAll?type=angular
(function (abp, angular) {
if (!angular) { return; } var abpModule = angular.module('abp'); abpModule.factory('abp.services.app.session', [ '$http', function ($http) { return new function () { this.getCurrentLoginInformations = function (httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/session/GetCurrentLoginInformations', method: 'POST', data: JSON.stringify({}) }, httpParams)); }; }; } ]);
})((abp || (abp = {})), (angular || undefined));
(function (abp, angular) {
if (!angular) { return; } var abpModule = angular.module('abp'); abpModule.factory('abp.services.app.user', [ '$http', function ($http) { return new function () { this.prohibitPermission = function (input, httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/user/ProhibitPermission', method: 'POST', data: JSON.stringify(input) }, httpParams)); }; this.removeFromRole = function (userId, roleName, httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/user/RemoveFromRole?userId=' + escape(userId) + '&roleName=' + escape(roleName) + '', method: 'POST', data: JSON.stringify({}) }, httpParams)); }; }; } ]);
})((abp || (abp = {})), (angular || undefined));
(function (abp, angular) {
if (!angular) { return; } var abpModule = angular.module('abp'); abpModule.factory('abp.services.app.role', [ '$http', function ($http) { return new function () { this.updateRolePermissions = function (input, httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/role/UpdateRolePermissions', method: 'POST', data: JSON.stringify(input) }, httpParams)); }; }; } ]);
})((abp || (abp = {})), (angular || undefined));
(function (abp, angular) {
if (!angular) { return; } var abpModule = angular.module('abp'); abpModule.factory('abp.services.app.tenant', [ '$http', function ($http) { return new function () { this.getTenants = function (httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/tenant/GetTenants', method: 'POST', data: JSON.stringify({}) }, httpParams)); }; this.createTenant = function (input, httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/tenant/CreateTenant', method: 'POST', data: JSON.stringify(input) }, httpParams)); }; }; } ]);
})((abp || (abp = {})), (angular || undefined));
(function (abp, angular) {
if (!angular) { return; } var abpModule = angular.module('abp'); abpModule.factory('abp.services.app.person', [ '$http', function ($http) { return new function () { this.getAllPeople = function (httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/person/GetAllPeople', method: 'POST', data: JSON.stringify({}) }, httpParams)); }; }; } ]);
})((abp || (abp = {})), (angular || undefined));
(function (abp, angular) {
if (!angular) { return; } var abpModule = angular.module('abp'); abpModule.factory('abp.services.app.task', [ '$http', function ($http) { return new function () { this.getTasks = function (input, httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/task/GetTasks', method: 'POST', data: JSON.stringify(input) }, httpParams)); }; this.updateTask = function (input, httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/task/UpdateTask', method: 'POST', data: JSON.stringify(input) }, httpParams)); }; this.createTask = function (input, httpParams) { return $http(angular.extend({ abp: true, url: abp.appPath + 'api/services/app/task/CreateTask', method: 'POST', data: JSON.stringify(input) }, httpParams)); }; }; } ]);
})((abp || (abp = {})), (angular || undefined));
-
0
Hi,
Can you share the error. Output script seems good.