Base solution for your next web application
Open Closed

Generate services script for AngularJS on net core 8 #12168


User avatar
0
dominici created

Hi ismcagdas, I need to generate the sevices script for AngularJS on the latest version of AbpZero Net Core 8 version. This will allow me to use a new backend Net Core 8 with an old frontend AngularJs minimizing the refactoring.

What is the best way to do it? I've tried to investigate on master branch about the "internal class AngularProxyGenerator : IScriptProxyGenerator" but I can't understand if I can call it as the old version or something it's changed. Moreover that part seems still based on framework net 4.6.2 and seems also wrapped to be used by the Net Core 8 part...

Can you clarify why there are still projects in net framework version 4.6.2, how they are wrapped and what is the correct way to call/use the AngularProxyGenerator ?

Thanks in advance,

Fabrizio


1 Answer(s)
  • User Avatar
    0
    dominici created

    Hello ismcagdas, looking deeper into the code, I discovered that there is another project containing the ProxyScriptGeneratos classes. This project is Abp.Web.Common and this one is compatible with Net Core 8 because his target framework is .Net Standard 2.0

    So, I implemented my AngularJsProxyGenerator, like this

    public class AngularJsProxyGenerator : IProxyScriptGenerator, ITransientDependency
    {
        /// <summary>
        /// "angularJs".
        /// </summary>
        public const string Name = "angularjs";
    

    and then I added it to the ApiProxyScripting Generators :

                // Add custom ApiProxyScripting for AngularJs
                Configuration.Modules.AbpWebCommon().ApiProxyScripting.Generators.Add("angularjs",
                    typeof(AngularJsProxyGenerator)
                );
    

    and I can call it using the url -> https://localhost:44301/AbpServiceProxies/GetAll?type=angularjs&v=638629666671806923

    Finally it works as expected.

    Hope this helps

    Br, Fabrizio