我有一个带有transclude文本的指令我需要把它放在占位符
中我的HTML
<div ng-controller="Controller">
<my-dialog>Hello world!</my-dialog>
</div>
JS
(function(angular) {
'use strict';
angular.module('docsTransclusionDirective', [])
.controller('Controller', ['$scope', function($scope,$transclude) {
console.log($transclude);
$scope.name = $transclude; // I NEED TO GET HELLO WORLD HERE
}])
.directive('myDialog', function() {
return {
restrict: 'E',
transclude: true,
scope: {},
templateUrl: 'my-dialog.html'
};
});
})(window.angular);\
我的模板
<div>this should give me transcluded text {{name}}</div>