Deploying Angular2 project on Sharepoint online

半腔热情 提交于 2020-01-04 06:11:14

问题


I have a sample Angular2 Project (rc-4) created on my local environment which works fine.

Now I have to host this on SharePoint Online as a subsite. Unfortunately I have no clue on how to do it and what keywords to search for ?

I created a index page in Pages folder and added index.html to it as Web part

It gives me the error: System is undefined (because node_modules folder does not exist)

I tried to run npm install on the remote location

(First Had to edit registry to allow cmd on remote locations) Though the command give me lots of untar.error

Next i tried to copy the folder from my local env. to remote location which is running since 1 day and still not complete

I also synced Site Assets folder to my local system, copied node_modules folder into the location and let OneDrive for Business do the sync but to no avail.

Any suggestions?


回答1:


I realize this post is old but I thought I would help some other new SharePoint developers who are trying to do some custom page work!

Here is what I do:

  • run ng build // build a distro for your Angular project
  • create a document folder on SharePoint to host your Angular files
  • edit distro index.html file with the correct URL for the css and js files
    • https://[your domain name usually].sharepoint.com/[site name]/[folder with distro files]/
  • upload all of the distro files to SharePoint
  • create a new WEBPART page
  • edit WEBPART page and add a new Content Editor webpart
  • edit the new Content Editor and in the Content Link enter the URL to your new html file (index.html)

Incidentally this works for other frameworks to like jquery and bootstrap.



来源:https://stackoverflow.com/questions/38737101/deploying-angular2-project-on-sharepoint-online

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!