2. A bit about you…
Join the Conversation #SP2013Angular @DanielSmon
3. Daniel Šmon
@DanielSmon
11+ years in IT
Ex-Microsoft Consultant (SharePoint)
Moved from Australia to Slovenia
Plays the button accordion,
euphonium
Join the Conversation #SP2013Angular @DanielSmon
7. SharePoint or Provider Hosted?
SharePoint Hosted
• No external services required
• Declarative / JavaScript only
• User permissions
• Traditionally ‘lower complexity’
only
Provider Hosted
• Separate infrastructure required
• BYO server (.NET, Java, PHP…)
• App permissions (Low/High
Trust)
• Enterprise practices
Relatively easy to create and deploy, so they
are good for small team productivity apps
and business process automation, with
lower complexity business rules.
Choose patterns for developing and hosting
your app for SharePoint
http://msdn.microsoft.com/en-us/
library/office/fp179887(v=office.15).aspx
Join the Conversation #SP2013Angular @DanielSmon
13. Join the Conversation #SP2013Angular @DanielSmon
function GetModelBasesFromHiddenField() {
var modelBases = null;
var modelBasesValue = $("#hdnModelBases").val();
// Try to parse hidden value if it is present
try {
var modelBases = JSON.parse(modelBasesValue);
} catch (e) {
// Do nothing
}
// If the parsed value is an array, it is probably valid, so return it
if ($.isArray(modelBases)) {
return modelBases
} else {
// If not an array it means that the data is corrupt or missing, so we'll return an empty array
return [];
}
} function UpdateDisplayPrincipals(modelBases, updateHiddenFieldValue) {
// Persist to hidden field if required
if (updateHiddenFieldValue) {
$("#hdnModelBases").val(JSON.stringify(modelBases));
} // Reset existing display
$("#divDisplayPrincipals").html("");
// Populate preview with display names
$.each(modelBases, function (index, modelBase) {
// The text value in the span needs to be html encoded, whereas the ADName must have any backslashes escaped so that they don't get los
t when the javascript is executed
var taggeditem = "<span class='tagged'><span>" + htmlEncode(modelBase.DisplayName) + "</span>" + "<a href='#' class='removeTag' onclick
="removePrincipalsFromShareWith('" + escapeForJsBlock(modelBase.ADName) + "');">x</a></span>";
$(taggeditem).appendTo("#divDisplayPrincipals");
});
}
15. I need a provider hosted app…
• My requirements are too complex for JavaScript
• I have lots of different pages and views
Join the Conversation #SP2013Angular @DanielSmon
16. I really need server side code…
• I do things that need special permissions
• My data source doesn’t have a HTTP endpoint
Join the Conversation #SP2013Angular @DanielSmon
17. Data binding
Dependency Injection
Testing
Routing (deep linking)
Form validation
Localisation
Join the Conversation #SP2013Angular @DanielSmon
25. Getting Started
Package
Management
Templating
Front-End
Join the Conversation #SP2013Angular @DanielSmon
Build
JavaScript
Testing
The ‘Visual Studio’
way
The ‘Open Source’
way
The ‘long beard’
way
www… File > New
Manually write
minified
well…
Manually write
tests
27. Installation is in progress (00:00:43)
App failed to install, cleaning up...
Successfully uninstalled the app for SharePoint.
App installation encountered the following errors:
16/10/2014 9:09:47 AM
Join the Conversation #SP2013Angular @DanielSmon
@"Error 1
CorrelationId: f4b334ea-ba13-4c10-9ea0-ee355e1d6ba0
ErrorDetail: There was a problem with activating the app web definition.
ErrorType: App
ErrorTypeName: App Related
ExceptionMessage: Exception from HRESULT: 0x81070964
Source: AppWeb
SourceName: App Web Deployment
Error occurred in deployment step 'Install app for SharePoint': Failed to install app for
SharePoint. Please see the output window for details.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
AngularJS is a powerful MV* framework that allows you to write JavaScript applications in a similar way to traditional ASP.Net MVC. This is especially useful for creating SharePoint hosted apps without separate hosting for the provider hosted model.In this session I'll run through creating a SharePoint Hosted App from scratch, that can be deployed either to SharePoint in the cloud (O365), or on premises.
Who’s familiar with SharePoint Apps?
Provider Hosted? SharePoint Hosted?
Who’s used AngularJS?
Familiar with AngularJS?
SPA’s?
On the server side, practices are quite well established.
Multiple divs to simulate a ‘wizard’ style interface
Onclick events
Lots of JavaScript ‘glue’, rather than logic
You still from AngularJS, it will clean up client side and make it more manageable.
Powerful/ dynamic client side views (rich client side views).
Jeremy Thake - SharePoint 2013 Apps with AngularJS:
https://www.youtube.com/watch?v=hCHkn-helJg
Ted Pattison – SharePoint App best practices using Odata and the SharePoint REST API:
https://www.youtube.com/watch?v=tEbAaSyIn9I