0

What I'm trying to do or know if it's possible, is extends/share/reuse or anything like this:

Passing through my directive an specific attribute that will be used in a tag inside the directive template:

<app-autocomplete md-floating-label="Movies"></app-autocomplete>

And inside my directive tpl:

<md-autocomplete md-floating-label> <!-- where md-floating-label has the value: Movies -->

Why I want to do this? Because the md-autocomplete could be use in two different ways, having placeholder or md-floating-label. So I want to be able use one or other depending on my layout. I also want avoid the term don't repeat yourself.

If I do not use $scope, would be something like this, where also doesn't work:

<app-autocomplete placeholder="false" md-floating-label="Cidade">

<md-autocomplete placeholder="placeholder" md-floating-label="mdFloatingLabel">

So, any ideas?

Pablo
  • 1,953
  • 4
  • 28
  • 57

1 Answers1

0

But if your directive has no isolated scope u can use all $scope data of parent elements

uamanager
  • 1,128
  • 8
  • 11