Skip to content

Instantly share code, notes, and snippets.

@alex-wilmer
Created April 17, 2015 20:06
Show Gist options
  • Save alex-wilmer/34565401ae39839b9280 to your computer and use it in GitHub Desktop.
Save alex-wilmer/34565401ae39839b9280 to your computer and use it in GitHub Desktop.
function $web ($http) {
var post = function (method, data) {
$http({
method: 'POST'
, url: '/_layouts/15/CSN.SharePoint/CSNWebMethods.aspx/' + method
, headers: {'X-RequestDigest': $('[name="__REQUESTDIGEST"]').val()}
, data: data
})
.then(function () {
console.log('Post success!');
});
};
return {
post: function (method, data) {
post(method, data);
}
};
}
angular
.module('CSNapp')
.factory('$web', $web);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment