angularjs - Angular: how to scope a function call to directive instead of controller? -
angularjs - Angular: how to scope a function call to directive instead of controller? -
<my-dir ng-show="isvisible()"></my-dir>
isvisible phone call isvisible in controller.
what if want phone call isvisible within my-dir directive instead?
note: my-dir in application tree command recursively calls using $compile there may many of them nested within each other. using singleton service may not work because of asynchronicity.
edit: in retrospect right reply create filter directive. can say, angular different way of doing things.
if you're using directive have total command of element. this: <my-dir check-visible="true"></my-dir>
then in directive's link function can go: if(attrs.checkvisible) isvisible();
then can show or hide element like.
angularjs angularjs-directive
Comments
Post a Comment