2

I'm working on an AngularJS app and I'm stuck. I have a simple tabbled interface section with the same layout for every tab section. When I switch the tab, I check to see what conditions are met and, depending on the result, I want to disable some input elements (text area / buttons etc.).

Here's what I'm doing:

function switchEditTab(param)
{
    /* other stuff here */

    $scope.readyToShare = false;

    if($scope.current_storyboard.id_creator == $scope.currentIDUser)
    {
        $rootScope.enableOtherEdit = true;
    }
    else
    {
        $rootScope.enableOtherEdit = false;
    }

    /* other stuff here */
}

And the HTML

<input id="s_name" 
       caret-aware="cursor" 
       class="textLight s_input" 
       type="text" 
       placeholder="Type name..." 
       value="{{s.first.title}}" 
       ng-model="s.first.title"
       ng-class="{ input_warning: name_warning == true }"
       ng-disabled="!enableOtherEdit">
</input>

I checked the conditions and the result over and over again and it's fine but the ng-disabled is not working. In fact it's not working properly.

The weird thing is if click on the first tab the fields get disabled, except for the buttons, regardless if the condition is met or not. For all other tabs, nothing happens. Same goes for ng-readonly.

Any thoughts? I was unable to find a solution for this so far.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
daydr3am3r
  • 920
  • 4
  • 12
  • 31

0 Answers0