Here is my plunker - http://plnkr.co/edit/VYH5QbO99ZbMkvc2D4Fe?p=preview
- I want to keep the knowledge of controller method outside of directive so used Directive Attribute and pass controller method inside
- Now it is failing that
$digest already in progress(seeconsole.log)
UPDATE
The body of HTML in firebug looks like
<body data-ng-controller="SummaryController" class="ng-scope">
<h1>Hello Directive!</h1>
<ng-view></ng-view>
<div summary="loadPie1()">
<div>
<div id="pie1">I am pie 1</div>
<div id="pie2">I am pie 2</div>
</div>
</div>
</body>
Please help