Hi Anton,
If you need the scope of the transcluded part to be the same as the scope
it is originating that is entirely possible.
I agree that scopes and transclusion might be confusing for new users. I
filed a issue to address this, but there is
no outcome of that yet!
Here you go, create your directive like this:
(function () {
function paneFixed() {
var ddo = {
restrict: 'E',
transclude: true,
scope: {
title: '@'
}
};
ddo.template= '<div style="border: 1px solid black;">' +
'<div style="background-color: gray">{{title}} (isolate scope
id: {{$id}})</div>' +
'<fix-transclude></fix-transclude>' +
'</div>';
ddo.link = function (scope,elm,attr,contrl,transclFn) {
// attach the parent scope (originating one!) to the transcluded
content!
transclFn(scope.$parent,function (clone) {
elm.find('fix-transclude').empty().append(clone);
})
};
return ddo;
}
angular.module('scopeIssue',[])
.directive('paneFixed', paneFixed)
}())
Is this enough to get you going?
Regards
Sander
--
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.