-
-
Save adamrights/0e57d609b7d4febe8256 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
myapp.factory('Comments', function ($location) { | |
var isInitialized = false; | |
var comments = {}; | |
var getConfig = function(){ | |
var articleId = $location.path(); | |
var defaults = { | |
articleId: articleId, | |
collectionMeta: { | |
articleId: articleId, | |
url: fyre.conv.load.makeCollectionUrl(null, [], true) | |
} | |
}; | |
return defaults; | |
}; | |
var swapConfig = function(settings_object){}; | |
var init = function () { | |
isInitialized=true; | |
fyre.conv.load({ | |
el: 'livefyre-comments', | |
network: "livefyre.com", | |
siteId: "123456", | |
signed: false | |
}, [getConfig()], function callback(widget) { | |
swapConfig = widget.changeCollection; | |
}); | |
}; | |
var swap = function(){ | |
swapConfig(getConfig()); | |
}; | |
comments.run = function(){ | |
if(isInitialized){ | |
swap(); | |
} else { | |
init(); | |
} | |
} | |
return comments; | |
}); | |
function AppController($scope, Comments) { | |
Comments.run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment