Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Power tools, angular error after entity/module generation (9.2.1) #9807


User avatar
0
ashjackson created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? - 9.2.1
  • What is your product type (Angular or MVC)? - Angular
  • What is product framework type (.net framework or .net core)? - .net core

Hi, I have installed the the first time the power tools and created new entity (fully auditied of Guid) and associated module, rebuilt the host project, run nswag update as outlined in the documentation Angular has recompiled but now gives the following exception

core.js:4081 ERROR Error: Uncaught (in promise): Error: Component 'CompaniesComponent' is not resolved: templateUrl: ./companies.component.html

  • Did you run and wait for 'resolveComponentResources()'? Error: Component 'CompaniesComponent' is not resolved: templateUrl: ./companies.component.html
  • Did you run and wait for 'resolveComponentResources()'? at Function.get (core.js:25940) at getComponentDef (core.js:1833) at verifyDeclarationsHaveDefinitions (core.js:25637) at Array.forEach (``) at verifySemanticsOfNgModuleDef (core.js:25609) at Function.get (core.js:25567) at getInjectorDef (core.js:395) at R3Injector.processInjectorType (core.js:11114) at core.js:10986 at core.js:1136 at resolvePromise (zone.js:832) at resolvePromise (zone.js:784) at zone.js:894 at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:27126) at ZoneDelegate.invokeTask (zone.js:420) at Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:601)

As this appeared to be an angular error I dug around and found that the resolution to this issue was to add an explicit module id to the component declaration like this

<span class="colour" style="color: rgb(212, 212, 212);">@</span><span class="colour" style="color: rgb(78, 201, 176);">Component</span><span class="colour" style="color: rgb(212, 212, 212);">({</span> <span class="colour" style="color: rgb(156, 220, 254);">templateUrl</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> </span><span class="colour" style="color: rgb(206, 145, 120);">'./companies.component.html'</span><span class="colour" style="color: rgb(212, 212, 212);">,</span> <span class="colour" style="color: rgb(156, 220, 254);">encapsulation</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> </span><span class="colour" style="color: rgb(78, 201, 176);">ViewEncapsulation</span><span class="colour" style="color: rgb(212, 212, 212);">.</span><span class="colour" style="color: rgb(79, 193, 255);">None</span><span class="colour" style="color: rgb(212, 212, 212);">,</span> <span class="colour" style="color: rgb(156, 220, 254);">animations</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> [</span><span class="colour" style="color: rgb(220, 220, 170);">appModuleAnimation</span><span class="colour" style="color: rgb(212, 212, 212);">()],</span> <span class="colour" style="color: rgb(156, 220, 254);">moduleId</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> </span><span class="colour" style="color: rgb(156, 220, 254);">module</span><span class="colour" style="color: rgb(212, 212, 212);">.</span><span class="colour" style="color: rgb(156, 220, 254);">id</span> <span class="colour" style="color: rgb(212, 212, 212);">})</span> <span class="colour" style="color: rgb(212, 212, 212);"></span> Is this a bug in the power tools, or have I done something wrong? Please advise if I should update the template (and how) or if I need to do something else to enable use of the power tools correctly.

Kind Regards, AJ.


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ashjackson

    No, this is not an expected situation. Could you share the generated Json file of your entity which you can find under "aspnet-core\AspNetZeroRadTool" folder of your solution ?

    Thanks,

  • User Avatar
    0
    ashjackson created

    Hi there,

    This is the generated json file.

    {
      "IsRegenerate": false,
      "MenuPosition": "main",
      "RelativeNamespace": "Gpl.Companies",
      "EntityName": "Company",
      "EntityNamePlural": "Companies",
      "TableName": "Companies",
      "PrimaryKeyType": "Guid",
      "BaseClass": "FullAuditedEntity",
      "EntityHistory": true,
      "AutoMigration": false,
      "UpdateDatabase": false,
      "CreateUserInterface": true,
      "CreateViewOnly": true,
      "CreateExcelExport": true,
      "IsNonModalCRUDPage": false,
      "IsMasterDetailPage": false,
      "PagePermission": {
        "Host": false,
        "Tenant": true
      },
      "Properties": [
        {
          "Name": "Code",
          "Type": "string",
          "MaxLength": 6,
          "MinLength": 3,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": true,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": true,
            "List": true,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_BusinessName",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": true,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": true,
            "List": true,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_Name",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": true,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": true,
            "List": true,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_Phone",
          "Type": "string",
          "MaxLength": 50,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": false,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": false,
            "List": true,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_Email",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": false,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": false,
            "List": true,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_Address1",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": true,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": true,
            "List": false,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_Address2",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": false,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": false,
            "List": false,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_City",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": true,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": true,
            "List": false,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_Area",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": false,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": false,
            "List": false,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Contact_PostCode",
          "Type": "string",
          "MaxLength": 10,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": true,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": true,
            "List": false,
            "CreateOrUpdate": true
          }
        },
        {
          "Name": "Name",
          "Type": "string",
          "MaxLength": 250,
          "MinLength": 0,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": true,
          "Nullable": false,
          "Regex": "",
          "UserInterface": {
            "AdvancedFilter": true,
            "List": true,
            "CreateOrUpdate": true
          }
        }
      ],
      "NavigationProperties": [],
      "NavigationPropertyOneToManyTables": [],
      "EnumDefinitions": [],
      "DbContext": null
    }
    

    Kind regards, AJ

  • User Avatar
    0
    musa.demir created

    Hi @ashjackson

    I could not reproduce the problem. It should add CompaniesComponent to declarations of main.module.ts. Can you please check that. And what is your powertool version?

  • User Avatar
    0
    ashjackson created

    Hi There,

    CompaniesComonent is decared in main.module.ts. My power tools version is 2.7.2

    AJ.

  • User Avatar
    0
    musa.demir created

    Hi @ashjackson

    Power tools is updated to version 2.7.3. Can you please update it and try to regenerate your entity

  • User Avatar
    0
    ashjackson created

    Hi There, The newest power tools version has resolved this problem. The additional module id field is no longer required.

    Thanks.