I have a factory that run facebook share function and I was able to make it
send back the result to the controller when calling it.
The thing is that I need to pass an arguments to the factory.
How can I dot it?
Thanks
Ihab
This is my factory code:
appServices.factory('FbShare', function() {
var run = function(callback) {
var pic = g_app_link + 'uploads/covers/ihab.png'; // + p_pic;
var obj = {
method: 'feed',
link: g_app_link + 'redir.php',
picture: pic,
name: g_share_txt,
caption: g_share_caption
};
FB.ui(obj, function(response) {
callback(response);
});
};
return {
run: run
};
});
And this is how I call it from the controller:
$scope.shareOnTimeline = function (p_pic) {
FbShare.run(function(response) {
if (response && !response.error_code) {
console.log('shared');
} else {
// this option just in case we need a deffirent behaviour when
not shared
console.log('share cancled');
}
});
};
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.