Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Tabs with an expression for the 'active' attribute break #1791

Closed
Aklakan opened this issue Feb 12, 2014 · 5 comments
Closed

Tabs with an expression for the 'active' attribute break #1791

Aklakan opened this issue Feb 12, 2014 · 5 comments

Comments

@Aklakan
Copy link

Aklakan commented Feb 12, 2014

With v0.10.0 (via bower) I am trying to obtain a tab's active state from an expression, such as <tab active="{{foo() == bar}}">...</tab>", however it breaks with 'undefined is not a function'
It seems that a simply wrapping the setActive call with an if statement does the trick:

      getActive = $parse(attrs.active);
      setActive = getActive.assign;
    //...
    scope.$watch('active', function(active) {
      // Note this watcher also initializes and assigns scope.active to the
      // attrs.active expression.
      if(setActive) { // <--- Add this
          setActive(scope.$parent, active); // <-- This breaks because an expression's value can't be set
      } // <--- Add this
@Aklakan
Copy link
Author

Aklakan commented Feb 12, 2014

Ok, I guess I was to hasty - just looked at the latest source, and it looks quite different - so the issue might already be fixed in the source

@Foxandxss
Copy link
Contributor

That concrete snippet of code has been changed to Angular 1.2.x optional two-way databinding, so maybe it works for you know.

@xaralis
Copy link

xaralis commented Feb 13, 2014

Were you able to make this work? Suffering from the same issue right now..

@Droogans
Copy link

Droogans commented Dec 4, 2014

@Foxandxss after confirming that I'm running v0.12.0, I'm now getting correct behavior, but a noassign error from Angular.

By changing the statement to a property on scope, I'm getting no errors.

@rvanbaalen
Copy link
Contributor

Continuing in #1496

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants