<!DOCTYPE html>
<html ng-app='app'>
<!--
A attribute属性:当做属性来使用
<div xingoo></div>
  E element元素:当做标签元素来使用
<xingoo></xingoo>
  C class类:当做CSS样式来使用
<div class="xingoo"></div>
  M comments注释:当做注释使用(这种方式在1.2版本下亲测不可用!)
-->
<head>
<meta charset="utf-8">
<title translate="TITLE">Basic usage</title>
<style>body { text-align: center; }</style>
</head>

<body ng-controller="ctrl">
<hello></hello>
<label>{{name}}</label>
<input type="text" set-Focus="">
<script type="text/javascript" src="../script/angular.js"></script>
<script type="text/javascript">
var myApp = angular.module('app',[]);
myApp.controller('ctrl', ['$scope', function($scope) {
$scope.name = "姓名";
}]);
myApp.directive('setFocus', function(){
return {
restrict: 'A',//A 表示attribute属性
link: function(scope, element){
element[0].focus();
}
};

});
myApp.directive('hello', function() {
return {
restrict: 'E', //E 表示 element元素
template: '<div>Hi there</div>',
replace: true
};
});
</script>

</body>
</html>

最新文章

  1. UNITY自带的PACKAGE的UTILITY 里面有一个自带的FPS COUNTER
  2. Android的Intent.FLAG_ACTIVITY_CLEAR_TOP无效
  3. Qt : QProcess
  4. redirect和forward
  5. MS SQL中使用UPDATE ... INNER JOIN ...
  6. Windows系统下远程Linux系统
  7. rsyslog 传输日志
  8. FxZ,C#开发职位面试测试题(30分钟内必须完成)
  9. Java中的继承性特性
  10. 初识java这个小姑娘(一)
  11. Linux开机时停在 Starting sendmail 不动了的解决方案
  12. Springmvc对就jdbc封装的操作
  13. Linux环境下使用Android NDK编译c/c++生成可执行文件
  14. 19)django-cookie使用
  15. webpack学习笔记--配置plugins
  16. javascript 易错点、难点笔记
  17. 本地mysql快速迁移到服务器数据库中
  18. spring boot 使用velocity模板(十六)
  19. Windows自带NAT端口映射,命令行CMD操作即可
  20. c#编程指南(三) 泛型委托(Generic Delegate)

热门文章

  1. Python—列表元组和字典
  2. LeetCode随缘刷题之最短补全词
  3. Solution -「APIO 2018」「洛谷 P4630」铁人两项
  4. WebGL 与 WebGPU比对[4] - Uniform
  5. c++ 汇编代码看内存分配
  6. 前端程序员初步认识 docker
  7. 定制Centos7.9镜像
  8. pytest(13)-多线程、多进程执行用例
  9. Vue 源码解读(4)—— 异步更新
  10. 『无为则无心』Python面向对象 — 55、多层继承和继承中的私有成员