angular-ui / bootstrap-bower

This is a bower repository to hold Angular UI Bootstrap releases.
http://angular-ui.github.com/bootstrap/
158 stars 326 forks source link

typeahead directive's properties can't be dynamic #16

Closed zzal closed 10 years ago

zzal commented 10 years ago

Hi,

Since some options are set within link function, they are not dynamic. For instance, if I set a property:

typeahead-editable="isAtLeastAdmin()"

or:

typeahead-editable="{{ isAtLeastAdmin() }}"

The changes in the result of the $scope.isAtLeastAdmin function are never passed to the typeahead directive.

So what I suggest is to not set theses options in private variables. I can attempt what I'm trying if I change line #3170:

  if (originalScope.$eval(attrs.typeaheadEditable) !== false) {
    return inputValue;
  } else {

and use it like this: typeahead-editable="isAtLeastAdmin()"

Maybe I should make a pull request, or someone have an idea for a better implementation?

Thanks!

zzal commented 10 years ago

I'll post that in the original Github repo… I'm sorry.