Last active
August 29, 2015 13:56
-
-
Save LongLiveCHIEF/9320683 to your computer and use it in GitHub Desktop.
SharePoint site provider factory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.config(['spSiteProvider',function(spSiteProvider){ | |
spSiteProvider.siteSvcUrl('https://myspsite.com/_vti_bin/listdata.svc') | |
}]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller('theCtrl',['$http','spSite',function($http,spSite){ | |
var splist = spSite.getListData('listA').then(function(data){ | |
//do something with data | |
}) | |
}]) |
and tried adding as a prop on the SpSite
function:
this.$inject = ['$http'];
Got it! took me long enough...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the only problem I'm having is figuring out how to inject
$http
into theSpSite
factory. Hmmm.Tried injecting it in the provider, but
$http
is not available at that point in the application. The factory is configured to use case by case instead of application wide, and I haven't had much luck passing$http
as a parameter for the factory. Wonder if defining the factory like: