Skip to content

Commit a0a0939

Browse files
committed
0.4.1: bugfix
fix directive renderer bug
1 parent be97c9c commit a0a0939

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "duoshuo",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"authors": [
55
"turing <o.u.turing@gmail.com>"
66
],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-duoshuo",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "a duoshuo SDK for angular.js, pure front-end, cross-domain request supported.",
55
"main": "dist/duoshuo.min.js",
66
"scripts": {

src/duoshuo.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
// comments renderer
4848
this.render = function(element) {
4949
if (!window.DUOSHUO) throw new Error('duoshuo embed.js required!');
50-
window.DUOSHUO.EmbedThread(element);
50+
var data = {};
51+
if (attrs.threadId) data['thread-id'] = attrs.threadId;
52+
if (attrs.threadKey) data['thread-key'] = attrs.threadKey;
53+
return window.DUOSHUO.createEmbedThread('div', data);
5154
};
5255
})
5356
.directive('duoshuo', function($duoshuo){
@@ -57,7 +60,8 @@
5760
template: '<div class="ds-thread"></div>',
5861
link: function(scope, element, attrs) {
5962
// render comments when dom has been injected.
60-
$duoshuo.render(element[0]);
63+
angular.element(element[0])
64+
.append($duoshuo.render(attrs));
6165
}
6266
};
6367
});

0 commit comments

Comments
 (0)