質問編集履歴

2

DOMContentLoadedのことについて追記

2017/06/20 02:51

投稿

conbufan
conbufan

スコア10

test CHANGED
File without changes
test CHANGED
@@ -52,7 +52,7 @@
52
52
 
53
53
 
54
54
 
55
- 具体的には、DomContentLoadedのタイミングで、下記のようにJSを読み込ませています。
55
+ 具体的には、DomContentLoadedのタイミングで、下記のようにJSを読み込ませています。(DOMContentLoadedが発火していることは確認済みです)
56
56
 
57
57
 
58
58
 

1

具体的にしていることを追記

2017/06/20 02:51

投稿

conbufan
conbufan

スコア10

test CHANGED
File without changes
test CHANGED
@@ -52,6 +52,52 @@
52
52
 
53
53
 
54
54
 
55
+ 具体的には、DomContentLoadedのタイミングで、下記のようにJSを読み込ませています。
56
+
57
+
58
+
59
+ ```ここに言語を入力
60
+
61
+ var script = document.createElement("script");
62
+
63
+ txt += 'appModule.directive("rendered", function () {';
64
+
65
+ txt += 'console.log("directive test!");';
66
+
67
+ txt += 'return {';
68
+
69
+ txt += 'restrict: "A",';
70
+
71
+ txt += 'link: function (scope, element) {';
72
+
73
+ txt += 'console.log("link test!");';
74
+
75
+ txt += ' element.bind("mouseenter", function () {';
76
+
77
+ txt += 'console.log("マウスin");';
78
+
79
+ txt += '});';
80
+
81
+ txt += '}';
82
+
83
+ txt += '}});';
84
+
85
+
86
+
87
+ script.textContent = txt ;
88
+
89
+ document.body.appendChild(script);
90
+
91
+ ```
92
+
93
+ まずdirectiveを読み込んでいれば「"directive test!"」が表示されるかと思いますが、これは反映されません。
94
+
95
+ もちろん、それ以降のconsole.logも無反応です。
96
+
97
+
98
+
99
+
100
+
55
101
  拙い説明でわかりにくいかと思いますが、
56
102
 
57
103
  ご教授いただけますと幸いです。