var app = angular.module("app",[]); app.run(["$templateCache", function($templateCache){ $templateCache.put("card.html", '<div class="card"><h1>Personel Kartı</h1><p>Bayram Üçüncü</p></div>'); }]); app.directive("card", [function(){ return { restrict: "E", templateUrl: 'card.html' } }]);
.card{ border: 2px solid #c54; width: 300px; padding: 15px; } .card h1{ color: #8de; }
<div ng-app="app"> <card></card> </div>