Can a template be inserted after an element using an angular directive?
I want to add the "example.html" template after the text-area.
Check out my plunker here: https://plnkr.co/edit/bdBjmsi2lIbzxtl0Uw89?p=preview
Currently, the HTML is inside the text-area tag (as seen in dev tools).
index.html
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<link rel="stylesheet" href="style.css">
<script data-require="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="67060900120b0615490d1427564952491f">[email protected]</a>" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js" data-semver="1.5.0"></script>
<script src="script.js"></script>
</head>
<body ng-controller="MainCtrl">
<form name="example-form">
<textarea rows="3" id="goal" name="name" data-ng-model="model.name" example="10"></textarea>
<example></example> <!-- Directive used here -->
</form>
</body>
</html>
script.js
app.directive('example', function() {
return {
restrict: 'A',
scope: {},
require: ['^form','ngModel'],
templateUrl: 'example.html',
link: function(scope, element, attrs, ctrls) {
console.log(element);
}
}
});
Thank you!