Angular 9 Deployment to SharePoint Online
Angular 9 Deployment to SharePoint Online is step-by-step guide on how to create and deploy an Angular 9 build to SharePoint Online using the page viewer web part, with visuals for each step.
Step-by-step guide on how to create and deploy an Angular 9 build to SharePoint Online using the page viewer web part, with visuals for each step.
ARC Team
· Updated November 27, 2019
In this blog, I am sharing how to create and deploy an Angular build to SharePoint Online by using the page viewer web part. I will cover the steps with visuals to make it as easy as possible.
Let’s start with the steps.
Angular 9 Deployment to SharePoint Online
Creating the Project
-
Open the folder where you want to create an angular project. My folder location is C:\Angular.
-
Write cmd on the address bar and press Enter.
-
CMD will be displayed. In CMD, write the command
ng new [project name]for creating a new project and press Enter. I’ve named my project DemoBuild. For default Angular Routing write Y and select style after that. -
The project will be created and displayed under Angular. Now open the project:
- Go to the Project folder location
- Press shift and right click then select Open PowerShell window here
-
PowerShell window will be displayed. Write
code .and press Enter. -
I am not writing any code in this blog — my goal is just to define how we can deploy the build. So let us run the project.
Running the Project
-
Open a new terminal window from the toolbar and write
ng serve -o. -
The project will be open on localhost. The project is running successfully.
Deploying the Build
-
Now before making the build, we need to do a small code change in app routing module.
- Open
app-routing.module.ts - Add the highlighted code
- Open
-
Let’s quit ng serve.
- Open terminal window
- Press CTRL + C or click on Kill terminal
-
Open a new terminal and write command
ng build. -
Wait for a few minutes until the build is completed.
- Then move to the project location. You will find a
distfolder - Open it and your build files will be ready
- Then move to the project location. You will find a
-
Change the extension of the index page from
.htmlto.aspx. -
Perform a few code changes in
Index.aspx:- Open
index.aspxpage and comment out or remove<base href="/">
- Open
-
In SharePoint, go to your site contents and create a folder.
- I have created a folder called “Demo”
-
Set the location of
.jsfiles in the scriptsrctag to the new folder created in SharePoint. -
Upload all files from the
distfolder to the SharePoint Demo folder. -
Click on
index.aspxpage. Your Angular app will be successfully open in SharePoint Online.
Conclusion
Our team of SharePoint experts is skilled in guaranteeing effective SharePoint development and solutions with results beyond expectations. They are experienced in creating new SharePoint custom development, enhancements to an existing SharePoint solution, or upgrades to the SharePoint environment. We have implemented solutions using Angular 9 and upgraded versions as well, including Renewal Tracking Application, Event Management solutions, and much more.
ARC Team
ARC Team
AI-powered Microsoft Solutions Partner delivering enterprise solutions on Azure, SharePoint, and Microsoft 365.
LinkedIn Profile