AngularJS: Custom directive calls function specified in binding element attribute. ( using $apply() method )