4

I have a little bit of a challenge here. I am attempting to create a dynamic javascript form in angular js with SharePoint but unfortunately do not have access to SharePoint Designer due to it being a company intranet version and they don't allow that. Which means I am not able to build a SharePoint App in Visual Studio apparently and connect it to the Developer page of the site(we don't have that on the site).

Basically what I want is to create a nice looking custom form(the default version of the form is just uglier than ugly) which ties into a SP List(actually multiple lists based on what I will need to do with lookups to the main list) that allows users to enter/update/edit various things.

I have tried uploading the files as site assets and then using a content Web Part but that throws an error because there is a form on my HTML and it says I can't use that---I have tried to embed the HTML with javascript on the page itself but no matter how I do it, the same error keeps popping up which is "[$Injector:error!] Module "MainPage" is not found or is missing!" meaning it is not loading the scripts containing those before it tries to load the rest of the content on the HTML page.

I know there has got to be a solution to this but I don't know what it is as this is my first time using SharePoint for development purposes. Can somebody point me in the right direction as to how to ensure all my scripts load before it attempts to run the body of the HTML code?

1
  • make sure you have all these supporting scripts tags (jQuery, angular, css). I have built plenty of functioning angular apps inside a content editor webpart.
    – Mike
    Sep 7, 2017 at 20:40

2 Answers 2

2

You don't need SharePoint Designer and franky I think you're better off without it. You have a few options for creating what you're trying to do, and Content Editor is a totally valid approach.

You need to ensure you're not making stupid mistakes, like incorrectly referencing your JS files, so you need to start simple. Try a "Hello World" div. Then try to reference a simple JavaScript file with a console.log. Once you've got that working then you can start adding in your Angular resources. Work iteratively, and make sure you use the versioning feature in your site assets in case you need to roll back.

One last thing - ditch the <form>. Your web part is already enclosed in a form, and SharePoint doesn't like nested forms.

Good luck!

2
  • Thanks, I have been able to get a very simple angular form working, just not one that has JS files in the site asset directory...I'll have to check to see if that might be a relative directory issue...also I see another person who has gotten this working that put up a tutorial showing to put the HTML and script references inside a Content Placeholder on the SharePoint page...is this what is typically done? Here is the link to the example...going to try this and see if I can get it working. sharepointpals.com/post/Basics-of-AngularJS-in-SharePoint
    – MattE
    Sep 8, 2017 at 3:40
  • 1
    Got everything working and have built several sites using this method now. Thanks!
    – MattE
    Oct 12, 2018 at 17:53
1

My preference is Visual Studio latest edition. Powerful and built for SharePoint development.

I do not recommend using designer as Derek has stated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.