<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>angular</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script src=""></script>
<script src=""></script>
<link href="">
<script src="" type="text/javascript"></script>
</head>
<body ng-app="app">
<script type="text/javascript">
var app = angular.module("app",[]);
</script>
<div>
<div>
ng-transclude的使用(这个是官方的案例):
</div>
<div ng-controller="ExampleController">
<div>
<input ng-model="title"><br>
<textarea ng-model="text"></textarea> <br/>
<pane title="{{title}}">{{text}}</pane>
</div>
</div>
<script type="text/javascript">
app.directive('pane', function(){
return {
restrict: 'E',
transclude: true,
scope: { title:'@' },
template: '<div>' +
'<div>{{title}}</div>' +
'<ng-transclude></ng-transclude>' +
'</div>'
};
})
.controller('ExampleController', ['$scope', function($scope) {
$scope.title = 'Lorem Ipsum';
$scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
}]);
</script>
</div>
</body>
</html>
一下验证邮箱准确性的例子:
复制代码 代码如下: