angularjs自定义标签

myHtml.html页面

<html ng-app="myApp"> <head> <title>MyHtml.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="js/angularjs.js"></script>
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>


test001.js
var app=angular.module('myApp',[]);
app.directive('myDirective',function(){
return {
restrict:'EACM',
replace:true,//加上之后,源标签被替换掉,如果没加,那么template会加到源标签下面
template:'Click me to go to baidu'
};
});
replace:true,//加上之后,源标签被替换掉,如果没加,那么template会加到源标签下面

要加的提示信息都写在了注释里面

驼峰命名风格用来将一个短语写在一个单词中,除了第一个单词外其他单词首字母大写,中间不加空格。列如,bumpy roads用驼峰风格来写应该是bumpyRoads

directive命名标签

posted on 2017-05-31 13:49  ShamSilence  阅读(187)  评论(0编辑  收藏  举报

导航