1、angularjs中自定义指令中的scope为什么找不到指令内部的表单元素
2、代码如下
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body ng-controller="myCtrl">
<test>
<form name="form1"></form>
</test>
<form name="form2"></form>
<script src="js/angular.min.js"></script>
<script>
var app = angular.module('myApp',[]);
app.controller('myCtrl',function(){
});
app.directive('test',function(){
return{
restrict:'EA',
transclude:true,
template:'<div ng-transclude></div>',
link:function(scope){
console.log(scope);
}
}
});
</script>
</body>
</html>
3、但是控制台中只有name=form2的表单