angularjs自定义标签

myHtml.html页面

<html ng-app="myApp"> <head> <title>MyHtml.html</title>





</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  阅读(205)  评论(0)    收藏  举报

导航