i have this situation:
<somebutton></somebutton>
...
app.directive("somebutton", function(){
return {
restrict: "E",
scope: {
// not sure what i can do here
},
template: '<button ng-click="loadTemplate()" type="button">Text</button>',
link: function(scope, element){
scope.loadTemplate = function(){
//TODO: append "home.html" template inside body directive
}
}
}
});
...
<script type="text/ng-template" id="home.html">
<div>home</div>
</script>
...
<div body ></div>
Other way of doing this could be to have the button in html instead of an template
<button ng-click="loadTemplate()" type="button">Text</button>
then maybe have a controller that has the loadTemplate() method that loads the template
but im not sure how this can be done.
Confusing? yes :)
Any ideas on this issue?
thanks