I have a question about this answers directive:
.directive( 'elemReady', function( $parse ) {
return {
restrict: 'A',
link: function( $scope, elem, attrs ) {
elem.ready(function(){
$scope.$apply(function(){
var func = $parse(attrs.elemReady);
func($scope);
})
})
}
}
})
And use:
<div elem-ready="someMethod()"></div>
My question is why do I need to pass someMethod plus () since in the directive we are turning it into a function (I still don't have a full grasp of what $parse does but I know it returns a function that can be called with a scope) and then we are calling it.
Thanks