I am using Core+Angular version 4.5.1, and a primeNG p-datatable to show a data set. One column is DateTime type from API, and it is automatically converted to moment.Moment type in service-proxies.ts. I can pipe the data to short-date format, such as: 08/12/2017. However, when I edit it in the datatable, it always initiates as "Sat Aug 12 2017 11:07:45 GMT-0400". How do I initiate the editor as "08/12/2017"?
I tried using p-inputMask as editor, and set mask = "99/99/9999", but the initial value shows wrong, as "12/20/1711".
I tried using p-calendar as editor, but it shows as an empty box without calendar content.
I tried formatting the data before populate to datatable, e.g. dataArray.Map(x=> x.date = moment(x.date).format('MM/dd/yyyy')); It failed because the x.date is moment.Moment type and cannot be assigned to a string type.
What is the practical option in this scenario?
Thanks,
It does the trick! Thanks!
I create a service "EditCustomer", which is very similar as "EditPerson" in PhoneBook example. It works fine, but the API shows on Swagger UI as POST (green bar), instead of PUT (brown bar). What did I miss?
The only thing different is that, the "Person" entity inherent from FullAuditedEntity and IMustHaveTenant, but my "Customer" entity inherent from Entiy only. Is that the reason? If so, how do I work around it?
Thanks,
I am trying v4.5.1 Core + Angular. It works fine on my local machine. The Core part works fine after published on production server. The UI part works on my local machine, but I got error while publish it with "ng build -prod":
ERROR in ng:///{{path}}/angular/node_modules/primeng/components/dropdown/dropdown.d.ts.Dropdown.html (6,13): Type 'string' is not assignable to type 'boolean'.
Any idea?
Thanks,
Thank you ismcagdas! This answer is very informative. There are two WhereIf extensions in Abp assembly:
Abp.Collections.Extensions.EnumerableExtensions.WhereIf<T>(), which is type of IEnumerable<T>; and Abp.Linq.Extensions.QueryableExtensions.WhereIf<T>(), which is type of IQueryable<T>.
I should use IQueryable<T> WhereIf(), but carelessly selected "using Abp.Collections.Extensions;" because it is on top of intelligence popup in VS.
Hope this experience is useful for other subscribers.
BTW, as I mentioned on my last post, there are 48 updates are waiting in the NuGet list in my VS, most of them are Abp 3.0.0. Shall I update them from current Abp 2.3.0 in my AspNetZero v 4.4.0?
Thanks again!
Thank you for clarification! I searched online as your suggestion, but it seems no easy workaround so far. The "Include" extension can only work in simple typical cases. I have to remove it from my application for now, and hope the ef core improves this feature soon.
Thanks again!
It is not the issue on my code only. You may try built-in APIs (e.g. /api/services/app/DemoUiComponents/GetCountries) on swagger UI or Postman. You may always see Response Code of 404.
In this scenario, it should throw out a 403 code, because I don't pass the authentication, I think.
I found the discrepancy. Your above code states the WhereIf() is type of IQueryable<T>, but in my package (Core + Angular 4.4.0), it is IEnumerable<T>. It is in Assembly Abp, version 2.3.0.0.
I thought the new AspNetZero version was updated. Shall I manually update the whole solution by NuGet every time to use a new version? :?: If so, it is not a big deal for me.
As I experienced before, the NuGet updating sometimes break your package/sample code. I just checked the version 4.4.0 in my VS2017, and there are 48 updates are waiting in the NuGet list, including Abp, Microsoft, xunit, and some other 3rd parties. Can you advise me which one I need to update?
Thanks,
I am running a similar service as PhoneBook example:
public ListResultDto<PersonListDto> GetPeople(GetPeopleInput input)
{
var people = _personRepository
.GetAll().Include(p => p.Phones)
//.Include(p => p.Phones.Where(x=>x.Number=="1112242")) .WhereIf( !input.Filter.IsNullOrEmpty(), p => p.Name.Contains(input.Filter) || p.Surname.Contains(input.Filter) || p.EmailAddress.Contains(input.Filter) ) .OrderBy(p => p.Name) .ThenBy(p => p.Surname) .ToList();
return new ListResultDto<PersonListDto>(ObjectMapper.Map<List<PersonListDto>>(people));
}
It works fine. Now, I need a condition in the "include" method, so I replaced the above ".Include(p => p.Phones)" with ".Include(p => p.Phones.Where(x=>x.Number=="1112242"))". I got a run-time error:
The property expression 'p => {from Phones x in [p].Phones where ([x].Number=="112242") select [x]}' is not valid. The expression should represent a property access: 't => t.MyProperty'. For more information on including related data, see <a class="postlink" href="http://go.microsoft.com/fwlink/?LinkID=746393">http://go.microsoft.com/fwlink/?LinkID=746393</a>.
I visited Microsoft link as mentioned in the message, but still no clue.
Can you advise me how to add a condition (or other such as .Distinct(), .First()...) in the .Include method?
Thanks,
I used AbpAuthorize notation to add an AppPermissions on a service. When I tried it with Swagger or Postman, it returns "404 Not Found" error, instead of "403 Forbidden". Did I miss something?
I prefer to get 403 error while the user's request is not permitted. Is that possible or easy to set?
Thanks, p.s. I am using Core + Angular version 4.4.0