When creating a directive with isolate scope, but no template in the directive, but with some dom inside the directive, the dom inside the directive can not bind to the scope of the directive.
<div ng-controller="testCtrl">
{{hehe}}
<hr/>
<div test-directive="hello" >
Directive Data:
<div>{{test}}</div>
</div>
</div>
angular.module('app',[])
.controller("testCtrl",['$scope', function ($scope) {
$scope.hehe = "test from controller";
}])
.directive("testDirective",function(){
return{
scope: {
"testDirective": "="
},
controller: ['$scope', function ($scope) {
$scope.test = "test from directive";
}]
};
});
In the demo, there are two angular lib versions, 1.1.5 and 1.2.4, and one of them is commented.
The code works with 1.1.5 but not with 1.2.4.
Can someone explain what is happening?