Hi @ All.

Following code:

<div ng-app="test" ng-controller="Main">
    <test-directive ng-model="test">
         <h1>{{item}}</h1>
    </test-directive>
</div>
<script type="text/javascript" src="./_lib/jquery.js"></script>
<script type="text/javascript" src="./_lib/angular.js"></script>
<script type="text/javascript">
angular.module('test', [])
.controller('Main', function ($scope) {
    $scope.test = 'Hello, World!';
})
.directive('testDirective', function ($compile, $sce) {
    return {
        restrict: 'E',
        scope: {
            model: '=ngModel'
        },
        replace: true,
        transclude: true,
        template: '<div style="background-color: red;" 
ng-bind-html="content"></div>',
        controller: function ($scope, $element, $transclude) {
            $scope.update = function () {
                var scope = $scope.$new(true);
                scope.item = $scope.model;
                $scope.content = $sce.trustAsHtml($('<div>').append(
$transclude(scope)).html());
            };


            $scope.update();
            $scope.$watch('model', $scope.update);
        }
    };
});
</script>


Why does the $transclude(scope) not replace {{item}} with the corresponding 
value?

Regards, Christian

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to