質問編集履歴
2
DOMContentLoadedのことについて追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
データバインドの話題では、$scope.$applyという物があるようですが、
|
26
26
|
これとは違うようです。
|
27
27
|
|
28
|
-
具体的には、DomContentLoadedのタイミングで、下記のようにJSを読み込ませています。
|
28
|
+
具体的には、DomContentLoadedのタイミングで、下記のようにJSを読み込ませています。(DOMContentLoadedが発火していることは確認済みです)
|
29
29
|
|
30
30
|
```ここに言語を入力
|
31
31
|
var script = document.createElement("script");
|
1
具体的にしていることを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,6 +25,29 @@
|
|
25
25
|
データバインドの話題では、$scope.$applyという物があるようですが、
|
26
26
|
これとは違うようです。
|
27
27
|
|
28
|
+
具体的には、DomContentLoadedのタイミングで、下記のようにJSを読み込ませています。
|
29
|
+
|
30
|
+
```ここに言語を入力
|
31
|
+
var script = document.createElement("script");
|
32
|
+
txt += 'appModule.directive("rendered", function () {';
|
33
|
+
txt += 'console.log("directive test!");';
|
34
|
+
txt += 'return {';
|
35
|
+
txt += 'restrict: "A",';
|
36
|
+
txt += 'link: function (scope, element) {';
|
37
|
+
txt += 'console.log("link test!");';
|
38
|
+
txt += ' element.bind("mouseenter", function () {';
|
39
|
+
txt += 'console.log("マウスin");';
|
40
|
+
txt += '});';
|
41
|
+
txt += '}';
|
42
|
+
txt += '}});';
|
43
|
+
|
44
|
+
script.textContent = txt ;
|
45
|
+
document.body.appendChild(script);
|
46
|
+
```
|
47
|
+
まずdirectiveを読み込んでいれば「"directive test!"」が表示されるかと思いますが、これは反映されません。
|
48
|
+
もちろん、それ以降のconsole.logも無反応です。
|
49
|
+
|
50
|
+
|
28
51
|
拙い説明でわかりにくいかと思いますが、
|
29
52
|
ご教授いただけますと幸いです。
|
30
53
|
よろしくお願いいたします。
|