<!DOCTYPE HTML>
<html ng-app="MyModule">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>独立作用域</title>
<link rel="stylesheet" href="CSS/bootstrap.css">
<script src="angular.min.js"></script>
</head>
<body>
<hello></hello>
<hello></hello>
<hello></hello>
<hello></hello>
</body>
<script>
var myModule = angular.module("MyModule",[]);
myModule.directive("hello",function(){
return{
scope :{},
restrict : 'AE',
template : '<div><input type="text" ng-model="username"/>{{username}}</div>',
replace : true
}
})
</script>
</html>