thank you it works just fine by adding this method and call it in AppPreBootstrap
AppPreBootstrap.getEnums(callback);
private static getEnums(callback: () => void) {
return abp.ajax({
url: AppConsts.remoteServiceBaseUrl + '/Enums',
method: 'GET'
}).done(result => {
AppConsts.Enums = JSON.parse(result.data);
callback();
});
}
but i wounder if you can explain to me this methods in some details 1-
static bootstrap<TM>(moduleType: Type<TM>, compilerOptions?: CompilerOptions | CompilerOptions[]): Promise<NgModuleRef<TM>> {
return platformBrowserDynamic().bootstrapModule(moduleType, compilerOptions);
}
2- (callback: () => void) that exists in many methods
thanks
Thank you for your help
for public website separation i almost get the idea but what about the project web.host that responsible for hosting API do i need to create public website (separated one) in the same solution or in different solution , so what about the existing one ?
Hi i'll try and let you know
Thanks
Hi @ismcagdas
I know that Separation is not that easy and i'm asking you to help me with that because you got the experience as you mention from Angular 2 version so any ideas how can i do that or what point should i start with to make separation as you did in Angular 2? can you share with me your experience about that ? what if i need just to separate public website as first step ?
thanks
Hello
I've been read the discussion in this post [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=9233]) and i understand your point of view , i don't deny i disappointed of your decision about your plans for Angular 1.x version as i'm a big fan of it and now i have to rewrite my application from beginning to get advantages of Angular 2.x version i know that you will continue supporting Angular 1.x as much as you can but i have one request that is not easy for me to do alone and may some members will agree with me on it like this post [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=4374&p=10413])
Projects Separation what i meant as you did in Angular 2.x which is great done by the way this issue cause me a lot of problems and i hope to solve this problems in next releases or at least provide detailed instructions to help us to do it myself
thanks
Hello
I have Enum defined in core project that i use in many places of my application even in backend or frontend , the reason why i do this is if i decide to change values of Enum's properties would be in one place
namespace Umbrella.Models.Helpers
{
public static class Enums
{
public enum CategoryType
{
Article = 1,
Blog = 2,
Faq = 3,
Gallery = 4,
News = 5,
Service = 6,
Video = 7,
Work = 8,
Slideshow = 9,
Testimonial = 10
}
}
}
and i created controller in Web.Host project to retrieve that Enum as Json
namespace Umbrella.Web.Controllers
{
public class EnumsController : UmbrellaControllerBase
{
[ResponseCache(Duration = Int32.MaxValue, Location = ResponseCacheLocation.Any)]
public JsonResult Index()
{
var enumType = typeof(Enums.CategoryType);
var enumDictionary = enumType
.GetFields()
.Where(x => x.IsLiteral)
.ToDictionary(x => x.Name, x => (int)Enum.Parse(enumType, x.Name));
var json = new JavaScriptSerializer().Serialize(enumDictionary);
return Json(new {Data = json});
}
}
}
so to call this controller i use this url [http://localhost:22742/Enums]) and this is the output
{
result: {
data: "{"Article":1,"Blog":2,"Faq":3,"Gallery":4,"News":5,"Service":6,"Video":7,"Work":8,"Slideshow":9,"Testimonial":10}"
},
targetUrl: null,
success: true,
error: null,
unAuthorizedRequest: false,
__abp: true
}
in frontend i created EnumService to retrieve this Enum
import { Observable } from 'rxjs/Observable';
import { Injectable } from "@angular/core";
import { Http } from "@angular/http";
import { AppConsts } from '@shared/AppConsts';
@Injectable()
export class EnumsService {
actionUrl = AppConsts.remoteServiceBaseUrl + '/Enums';
enums: any;
constructor(private _http: Http) {
this.getEnums();
}
getEnums(): any {
return this._http.get(this.actionUrl)
.subscribe((result) => {
this.enums = result.json().data;
});
// if (this.enums) {
// return Observable.of(this.enums);
// } else {
// return this._http.get(this.actionUrl)
// .map(res => res.json())
// .do((data) => {
// this.enums = data;
// });
// }
}
}
what i need to do is to call EnumService only on app initialization (just once) so how can i achieve that ? is there any something wrong in my code or better way to achieve my goal? could you please explain to me the Observable object as i'm so confused ? and then how can i use these values in any components (ts,html) ? hope my questions are clear enough
Thanks
Hello i have a question related to project core with Angular2 (.net 4.6.1) How can i pass TenantId as url parameter (query string) in login page and register page? because i don't user to enter his tenant id as i'm going to hide choosing tenant section
thanks
Hi @ismcagdas Thank you for ur reply and help BWT i created ticket as u ask :) [https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2232])
thanks
Hi @ismcagdas
BWT i didn't made any changes to users page in both client side and server side and i have the problem all my pages that i use ui-grid ,
returned data
result:
{totalCount: 1, items: [{name: "admin", surname: "System Administrator", userName: "admin",…}]}
thanks
Hi @ismcagdas
yes that what i meant actually as mention in documentation ASP.NET Core's default provider uses culture & ui-culture URL query string values if present but ASP.NET MVC 5.x don't , so how can i implement same behavior here as i still using ASP.NET MVC 5.x
Thanks