var app = angular.module('app', [
'templates'
]);
(function (){
app
.controller("templateCtrl", ["$scope", function($scope){
$scope.templatePath = "registration/form";
this.changeTemplate = function(path) {
$scope.templatePath = path;
};
}])
.directive("viewer", function(){
return {
template: "Path: " + templatePath,
}
});
})();
<body>
<div class="container-fluid" ng-controller="templateCtrl">
<viewer></viewer>
</div>
<script src="libs/libs.min.js"></script>
<script src="js/main.min.js"></script>
</body>
app
.controller("templateCtrl", function ($scope, $templateCache){
$scope.templatePath = "registration/form";
$scope.template = $templateCache.get($scope.templatePath);
})
.directive("templateview", function (){
return {
scope: {
template: "="
},
restrict: "E",
template: "{{template}}",
link: function (scope){
console.log(scope);
}
}
});
<templateview data-template="template"></templateview>