Using tabs causes $scope.$watch() functions to not get called
$scope.$watch('service', function () {
alert("Changed");
});
I use the above code in my controller and it's used with a select box, like so:
<select ng-model="service" ng-options="service.name for service in services">
<option value="">-- Choose Service --</option>
</select>
Works perfectly. Now I put that select inside of a tab, like below, and the watch method is never again called.
<tabset>
<tab>
<select ng-model="service" ng-options="service.name for service in services">
<option value="">-- Choose Service --</option>
</select>
</tab>
</tabset>
I think I'm having a related issue...
I have a textarea that works fine outside of a tabset.
<textarea ng-model="testingTextArea"></textarea>
I can initialize testingTextArea like so:
$scope.testingTextArea = "Testing 123!";
... and the textarea will be prepopulated when I load the page and I can update it fine by editing the contents of the textarea.
If I move it inside a tabset...
<tabset>
<tab>
<textarea ng-model="testingTextArea2"></textarea>
</tab>
</tabset>
It still prepopulates (one-way binding) but editing the contents of the textarea does not result in the model being updated.
Also, when I put watches on both...
$scope.$watch('testingTextArea', function() { alert('Changed'); });
$scope.$watch('testingTextArea2', function() { alert('Changed'); });
... the first one fires but the second one never does. My first thought was "maybe the tabs are creating a child scope," but if that were the case, wouldn't the textarea fail to prepopulate as well and not just fail to update the model on edit?
Solution is here: #437
Working as intended. See Understanding Scopes in the Angular.js Wiki.