Source:comment.directive.js

(function () {
    'use strict';
    // Blog comments
    angular
        .module('mohistory')
        .directive('comment', comment);
    comment.$inject = ['$rootScope'];
    /**
     * 
     * @name comment
     * @memberof mohistory
     * @ngdoc directive
     */
    function comment($rootScope) {
        var directive = {
            link: comment,
            restrict: 'A',
        };
        return directive;
        /**
         * @param {String} scope an AngularJS scope object.
         * @param {String} element the jqLite-wrapped element that this directive matches.
         * @param {String} attrs a hash object with key-value pairs of normalized attribute
         * names their corresponding attribute values.
         * @memberof comment
         */
        function comment(scope, element, attrs) {
            var comSection = element.find('#coral_talk_stream');
            console.log(comSection)
            Coral.Talk.render(document.getElementById('coral_talk_stream'), {talk: 'http://10.225.11.32:3000/'});
            /*if (comSection) {
                comSection.on('load', setComment);
                scope.$watch(function () {
                    return $rootScope.viewport.width;
                }, setComment);
                scope.$on('$destroy', function () {
                    comSection.off('load', setComment);
                });
            }*/
            function setComment() {
              Coral.Talk.render(comSection, {talk: 'http://10.225.11.32:3000/'});
              console.log('setComment running')
            }
        }
    }
})();