Friday, July 7, 2023

issues while working on .net core angular crud

 ===================================================================

Notes

===================================================================





===================================================================

VS Code Extension

these extension are installed when I was working on this project.

Angular Language Service

===================================================================





===================================================================

Issues faced on Angular Side

------------------------------------------------------------------

1- Angular CLI Version

I first install angular cli but due to old node js version it was not installing correctly so I did update the version of node js. but after updating the verion angular cli was

giving me another error:

Error: You need to specify a command before moving on. Use '--help' to view the available commands

so I used this technique to fix the issue

100


Uninstall Angular old version & Install latest version (14)


npm uninstall -g @angular/cli 

npm install -g @angular/cli

Use:


ng version | ng v

Instead of:


ng -v | ng --version


------------------------------------------------------------------

2- Now when I'm running my project after creating new angular project by running command (ng new {projectName}), I'm facing issue on running command: ng serve --open or ng server

issue: ng : File C:\Users\TK-LPT-654\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system. For more information, 

see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.


you need to give permission to you CurrentUser as RemoteSigned, for this purpose enter the below command:


Set-ExecutionPolicy RemoteSigned -Scope CurrentUser 


one more thing I want to add, I was making a mistake while running this command. I'm running this command on window cammand prompt and I was getting error:

'Get-ExecutionPolicy' is not recognized as an internal or external command,

operable program or batch file.


so do not try to run on cmd instead use the visual studo code terminal and run this command and then it will work perfectly.


after running the above command

run another command

Get-ExecutionPolicy

result: RemoteSigned


also you can run this command 

Get-ExecutionPolicy -list

Result:

        Scope ExecutionPolicy

        ----- ---------------

MachinePolicy       Undefined

   UserPolicy       Undefined

      Process       Undefined

  CurrentUser    RemoteSigned

 LocalMachine       Undefined

------------------------------------------------------------------


I'm using angular 16 and I need to add baseapiurl in the environment but I noticed there is no such folder exists in the system. so now I came to know that in angular 15 and above versions

environment folder has been removed and now If we will have to add manually by running a command: ng g enviroments

then I was able to add the environment.


------------------------------------------------------------------


===================================================================



===================================================================

Issues faced on .NET 6 Side



------------------------------------------------------------------

when I was showing green lines on the model properties so when I tried to remove it by disabling the nullable from the project then I saw many errors

which were saying many type doesn't exist in the current context so I added manually then again I saw I added wrong namespace then I again went to the project

and saw I made a mistake I had disabled the ImplicitUsings instead of Nullable so be careful while changing Nullable.


------------------------------------------------------------------







===================================================================

rough work:

employee model:

id, name, email, phone, salary, department


===================================================================


No comments:

Post a Comment

Two Factor Authentication using .Net Core

Install Package dotnet add package GoogleAuthenticator --version 3.1.1 Model Changes public bool IsAuthenticatorReset { get; set; } public s...