In angularjs , I am making a treeview using directive.
return {
restrict: "E",
//replace: true,
scope: {member: '=', ShowDetailsCtrlFunc : '&'},
template: "<li><span ng-click=ShowDetailsCtrlFunc()>{{member.NodeName}}</span></li>",
controller: 'MainCtrl',
link: linkerfunc
}
Things are fine, but i observed that controller function calls multiple times while loading. Would be a great learning if explain me the concept behind this. Or is it possible to handle this and let the function execute only once ? I have created below plunker for same.
Thanks