<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.5.8" data-semver="1.5.8" src="https://code.angularjs.org/1.5.8/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="trans">
<div ng-controller="ctrlTrans">
<h2>{{mensaje}}</h2>
<div mia>
<button>Un botón</button>
<a href="#">y un enlace</a>
</div>
</div>
</body>
</html>
// Code goes here
var app = angular.module("trans", []);
app.controller("ctrlTrans",
function($scope) {
$scope.mensaje = "Ejemplo de transclusión";
});
app.directive('mia', function(){
return{
transclude: true,
template: '<div class="algo">Contenido de la directiva<div class="algo" ng-transclude></div></div>'
}
});
/* Styles go here */
.algo{
color:red;
}
Transclude