angularjs - How to check if output binding is given? -
how check if output binding given?
examplecode:
angular.module('tester', []); angular.module('tester').component('test', { template: '<h3></h3>', bindings: { callback : '&' }, controller: function() { // how check if callback binding given? // typeof this.callback === 'function' returns true // angular.isfunction(this.callback) returns true } });
if want check if binding given do:
if(this.callback) return true else return false
the value of this.callback available in component if binding there otherwise wont be.
Comments
Post a Comment