So here is the final solution. Thanks all for your feedback. We could not
have fixed it without this group.
Details Controller:
(function() {
var DetailsController = function($scope, $http, $routeParams, $sce,
dataFactory) {
storyId = $routeParams.itemId;
nextItem = $routeParams.itemId++;
$scope.stories = [];
function init() {
dataFactory.getStories().success(function(stories) {
$scope.stories = stories.articles;
$scope.whichItem = storyId;
$scope.$emit('gigya', $scope.stories[storyId].PostID);
$scope.nextArticle = nextItem;
$scope.totalList = stories.articles.length;
$scope.SkipValidation = function(value) {
return $sce.trustAsHtml(value);
};
})
.error(function(data, status, headers, config) {
$log.log(data.error + ' ' + status);
});
$scope.todaysDate = new Date();
}
init();
};
DetailsController.$inject = ['$scope', '$http', '$routeParams', '$sce',
'dataFactory'];
angular.module('myApp')
.controller('DetailsController', DetailsController);
}());
Directive:
angular.module('myApp').directive('gigyaComments', function () {
return{
template:"<div id='commentsDiv'></div>",
link:function(scope,elem,attrs){
scope.$on('gigya', function(event, data) {
var params = {
categoryID: 'Articles',
streamID: data,
version: 2,
containerID: 'commentsDiv',
cid:'',
enabledShareProviders: '',
useHiResIcons: true,
showLoginBar: true,
enabledProviders: "facebook,twitter,google"
};
gigya.comments.showCommentsUI(params);
});
}
}
});
Partial for details page:
<section ng-model="articles" class="story-details" id="main">
<div class="article-nav"><a class="prev-article"
href="#/details/{{stories.indexOf(stories[nextArticle-1])}}"
ng-disabled="whichItem == 0">Previous Story</a> <a
href="#/details/{{stories.indexOf(stories[nextArticle+1])}}"
class="next-article" ng-disabled="stories[nextArticle+1] ==
undefined">Next Story</a></div>
<article id="main-article" data-post-id="{{stories[whichItem].PostID}}">
<h2>{{stories[whichItem].title}}</h2>
<div class="date">Posted on {{stories[whichItem].pubDate | date:"MMMM
d',' yyyy '@' h:mm a" }}</div>
<div class="sharing-widget">
<a class="facebook_custom"
href="https://www.facebook.com/sharer/sharer.php?u={{stories[whichItem].link}}"></a>
<a class="twitter_custom" href="https://twitter.com/home?status=Via:
@radar_online: {{stories[whichItem].title}}:
{{stories[whichItem].link}}"></a>
<a class="plusone_custom"
href="https://plus.google.com/share?url={{stories[whichItem].link}}"></a>
<a class="pinterest_custom"
href="https://pinterest.com/pin/create/button/?url={{stories[whichItem].link}}&media={{stories[whichItem].featuredImage}}&description={{stories[whichItem].title}}"></a>
<!-- <a class="tumblr_custom"
href="http://www.tumblr.com/share/link?url={{stories[whichItem].link}}"></a>
-->
<a class="email_custom" href="mailto:?&subject=I wanted you to see this
article.&body=Check out this article: {{stories[whichItem].title}}
{{stories[whichItem].link}}." title="Share by Email"></a>
</div>
<img height="169" width="300" class="lead"
ng-src="{{stories[whichItem].featuredImage}}">
<span
ng-bind-html="SkipValidation(stories[whichItem].description)"></span>
<div class="author"><img ng-src="{{stories[whichItem].authorPhoto}}">
<span>By {{stories[whichItem].byline}}</span></div>
</article>
<div class="article-nav"><a class="prev-article"
href="#/details/{{stories.indexOf(stories[nextArticle-1])}}"
ng-disabled="whichItem == 0">Previous Story</a> <a
href="#/details/{{stories.indexOf(stories[nextArticle+1])}}"
class="next-article" ng-disabled="stories[nextArticle+1] ==
undefined">Next Story</a></div>
<div gigya-comments="{{stories[whichItem].PostID}}" ></div>
</section>
--
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.