2016-09-09 3 views
3

私はプレースホルダ内AngularJS:変数にNG-transcludeを置く(NG-transcludeはプレースホルダ)が

マイHTML

<div ng-controller="Controller"> 
    <my-dialog>Hello world!</my-dialog> 
    </div> 

JSを、それを配置する必要がありtranscludeテキストとディレクティブを持っています

(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> 
+0

テンプレート「my-dialog.html」を入力してください – Hornth

答えて

関連する問題