Upload
pinmarcht-tada
View
306
Download
0
Embed Size (px)
Citation preview
ただ さとし Twitter : @pinmarch_t Bioinformatics関係の仕事しています
(Perl, R, RStudio, etc.) 日常(業務)では(まだ)jQuery使ってます
入力した文字を表示する。 単純に表示するだけではおもしろくないので、塩基配列のreverse complement(逆相補配列)を表示 : 「フィルター」を使う
GAATTC GAATTC (変わってない!でも正しい)
AGAATTC GAATTCT
(今回の例では)
Controller • 使っていない
View • データバインディング {{}}(double-curly syntax interpolation)
ng-bindディレクティブ
Model • ng-modelディレクティブ
=
PerlのTemplate Toolkitライブラリにも ディレクティブはある http://www.template-toolkit.org/docs/manual/Directives.html
INSERT INCLUDE PROCESS ng-view WRAPPER BLOCK カスタムディレクティブ IF ng-if
FOREACH ng-repeat
etc.
DOM操作 (ng-bind, ng-view, ng-if, ng-repeat …)
イベント (ng-click, ng-mouseenter, ng-focus …)
Form (ng-model, input[], ng-list, ng-options, ng-disabled …)
その他 (ng-app, ng-init, ng-include, ng-model-options …)
カスタムディレクティブ(のちほど)
グラフを作るライブラリ: Flotr2 http://www.humblesoftware.com/flotr2/
入力したら、 入力された塩基の 分布を表示するように コントローラーと イベントの追加
フィルターをfilter.jsに移した
Flotr2ライブラリ
ng-changeイベント ディレクティブ
ng-controllerディレクティブ
Flotr2グラフ表示領域
index.html
“change_inputsequence()”
グラフのオプションなど
Flotr2が描画する対象要素
Flotr2グラフ描画メソッド
Controllerの定義 “$scope”を引数で受ける関数
change_inputsequence イベント用関数
※モジュールの取得をする場合、 後で読み込む側のjsでは引数を angular.module(‘app’, []) ではなく angular.module(‘app’)とすること
追加
ディレクティブの定義 restrict : ‘E’で要素に限定 template : 置き換える中身のテキスト
Before
After
app.js
index.html
HTML5仕様ではカスタム属性名には“data-”、カスタム要素名には”x-”を接頭辞として付与できる。 ディレクティブの名前にmyDirective (camel case)とすると、HTML上ではmy-directive/my_directive/data-my-directive/x:my-directiveのようになる。