I'm trying to find the Best way to Build a SharePoint site(not an app) with Angular. I've multiple Content Editor webparts where I use the REST/JSOM to load content(Ex: Image Slider, List of Calendar upcooming events, some angular forms etc..).The question is how to efficiently create webparts so that I can just add the webpart where ever I want in my site. Right now I'm using following method.
- create an app js and refer it JS in masterpage.
- create a root element in each layout file (or in masterpage main contentplaceholder)
- create a JS where I all the controllers resides(controllers.js-created by gulp, bundling) and refer in masterpage.
- Each CEWP have an element with ng-controller attribute. in VS, create folder for each webpart(we call it feature), create a html,service and controller.
bundle all controller and services into a single JS file and refer them in masterpage.
Is this the correct way to use angular with SharePoint? Please Guide if anyone have a better approach.
Thanks.