質問編集履歴

1

やりたいことのイメージを追記しました。

2017/06/09 07:34

投稿

ueda.kojiro
ueda.kojiro

スコア10

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,15 @@
6
6
 
7
7
  共通のモジュールを作って、そこから共通の表示ができるようにしたいと考えています。
8
8
 
9
- イメージとしては、以下のような感じです。
9
+ イメージとしては、例えば、モーダルダイアログを共通化したいと考えています。
10
+
11
+ モーダルダイアログのコンポーネントを作っておいて、どこからでも共通のモーダルダイアログが呼び出せるようにできないか、と考えています。
12
+
13
+ htmlに`<modal></modal>`と書いておけば、どこからでもmodalを操作できるようになったりしないかな?と思い、質問させていただきました。
14
+
15
+
16
+
17
+ ### 実装イメージ
10
18
 
11
19
 
12
20
 
@@ -14,9 +22,9 @@
14
22
 
15
23
  var common = angular.module( "common", [] );
16
24
 
17
- common.component( "alert", {
25
+ common.component( "modal", {
18
26
 
19
- template: "<div ng-bind="$ctrl.message" ng-show="$ctrl.isShowing"></div>",
27
+ template: "<div class="modal" ng-bind="$ctrl.message" ng-show="$ctrl.isShowing"></div>",
20
28
 
21
29
  controller: function() {
22
30
 
@@ -42,7 +50,7 @@
42
50
 
43
51
  app.component( "parent", {
44
52
 
45
- template: "<alert></alert>" +
53
+ template: "<modal></modal>" +
46
54
 
47
55
  "<button ng-click=\"$ctrl.onClick()\">Alert</button>";
48
56
 
@@ -61,6 +69,10 @@
61
69
  } );
62
70
 
63
71
  ```
72
+
73
+
74
+
75
+ ### 知りたいこと
64
76
 
65
77
 
66
78