Transclusion Scope Inheritence
A directive that changes a transcluded element's scope to that of the isolate scope rather than the parent scope.
by marknutter
HTML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<div ng-app="app">
<div ng-controller="AppCtrl">
<div ng-repeat="item in items" drag>
{{item}}
</div>
</div>
</div>
JavaScript
var app = angular.module("app", []);
app.controller("AppCtrl", function($scope) {
$scope.items = ["one", "two", "three"];
});
app.directive("drag", function($filter) {
return {
compile: function(tElement, tAttrs, transclude) {
return function (scope, element, attrs) {
$(element).draggable();
};
}
}
});