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>
テンプレート「my-dialog.html」を入力してください – Hornth