モジュール.directive( 名前 ,
function(){
return {
restrict: 'A',
template: 出力内容
};
});
<div ok="large">This is Large sample!</div>
<div ok="midium">This is Midium sample!</div>
<div ok="small">This is Small sample!</div>
template:function(scope, element){……});※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
myapp.directive('ok', function(){
return {
restrict: 'A',
template:function(scope, element){
var size = 24;
switch(element['ok']){
case 'large':
size = 48; break;
case 'midium':
size = 36; break;
case 'small':
size = 24; break;
}
var obj = scope[0];
var tag ='<span style="font-size:' + size
+ 'pt">' + scope[0].textContent
+ '</span>';
return tag;
}
};
});
| << 前へ |