I created a button with directive and need now on click to call the factory. The problem is when page opened it automatically call code. I need to do this with just one directive.
.directive("addcomment",addcomment);
function addcomment(){
var addComment = {
link: link,
restrict: "E",
template: '<input type="submit" addcomments class="btn btn-default pull-right" value="Send" />'
};
return addComment;
function link(scope, element, attrs){
//RUN FACTORY
};
}
}
Any solution for this?