>>Hi everybody,
>>
>>I am still not clear how directives work and how to make them optional.
>
>The link function passes a third parameter which lets you get at the attributes:
>
>
>// Instead of this:
> link: function (scope, element) {
>// Do this:
> link: function (scope, element, attrib) {
>
>
>Now you have access to the attributes, so to grab the value:
>
>
>var attribValue = attrib.smFocus
>
>
>(take a look at attrib in the debugger and you'll see the values it holds).
It seems to be working as it is returning nothing when I have it as sm-focus. My question is - how can I now check if it's empty or true as I only want to not execute code when it's false.
If it's not broken, fix it until it is.
My Blog