<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<script type="text/javascript" src="angular-1.3.0.js"></script> | |
<title></title> | |
<script> | |
var app = angular.module("timer", []); | |
app.directive("nowTime", function () { | |
return { | |
restrict: "EACM", | |
template: "<h3>" + new Date().toLocaleDateString() + " " + new Date().toLocaleTimeString() + "</h3>", | |
replace: true | |
} | |
}); | |
</script> | |
</head> | |
<body ng-app="timer"> | |
<now-time>当前时间:</now-time> | |
<!-- 标签: restrict: "E" - Element --> | |
<div now-time>当前时间:</div> | |
<!-- 属性: restrict: "A" - Attribute --> | |
<div class="now-time">当前时间:</div> | |
<!-- 类: restrict: "C" --> | |
<!-- directive: now-time --> <!-- 注释: restrict: "M" --> | |
</body> | |
</html> |
H5如何自定义标签
最新推荐文章于 2022-08-18 14:22:01 发布