I have a ElementReady directive:
<div elem-ready="{function:'setHeightColleagueColumn()',attribute:'{{true}}'}">
Directive:
link: (scope, elem, attrs) => {
const attributes = scope.$eval(attrs.elemReady);
const x = attributes.attribute === 'true';
const z = attributes.attribute;
}
In this case x
is a boolean value because it compares 2 string values which returns a boolean value. But z
is a string value.
This question > AngularJS: passing boolean value to directive shows you can use {{ booleanvalue }}
to pass a boolean value to a directive. But that's not working in my case because I'm sending a object.
I have to use this directive in multiple components and I can't use scope because it will give Multiple directives asking for new/isolated scope
error on certain components, so I followed this suggestion:
How do I pass multiple attributes into an Angular.js attribute directive? — this answer
Any suggestions how I can pass a boolean value instead of a string value?