A page from Bach's Fugue in Ab

A page from Bach’s Fugue in Ab

Like notes on a piano, web parts (or any kind of web widgets) are combined in new and unexpected ways on a page. Yet often they don’t play well together. Seemingly every example of an Angular Web Part posted on the web assumes it’s the only thing using Angular on the page. A second instance of the web part, or another web part that uses Angular, and they will clash in unpredictable ways. And what if an Angular master page comes along, or Microsoft decides to use Angular in a future version of SharePoint? The result will be a cacophony of script errors.

This might not be a problem in a SharePoint App where each web part runs on its own page in an IFrame, but it can cause real dissonance if web parts are running directly on a web page. This can happen in a Content Editor or Script Editor web part using Remote Provisioning, or a Visual Web Part in a farm or sandboxed solution.

There’s an easy solution to all this, and that is to start writing “well-tempered” web parts. About a page of well-composed JavaScript can mean the difference between solutions that work if you’re lucky and solutions that just work. This article dives into the details and includes a complete code listing, along with musical accompaniment. Please check it out, or send your developers.

Thanks!