AngularJS: 将 ng-transclude 放入变量中(ng-transclude 到占位符)

AngularJS: Putting ng-transclude into a variable (ng-transclude to placeholder)

我有一个带有嵌入文本的指令,我需要将它放在占位符中

我的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>

获取嵌入内容的方法有多种。 Have a look at this question