2016-09-09 1 views
3

Ich habe eine Richtlinie mit transcluden Text ich es in PlatzhalterAngularJS: Setzen ng-transcluden in eine Variable (ng-transcluden Platzhalter)

Meine html

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

JS

setzen müssen
(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);\ 

Meine Vorlage

<div>this should give me transcluded text {{name}}</div> 
+0

Bitte geben Sie Ihre Vorlage 'my-dialog.html' an – Hornth

Antwort

Verwandte Themen