I'm trying to use ng-switch on a controller variable and it's not working as expected or I am missing something. I'd like to switch on the user_id which is defined in the controller.
Here is a plunkr
Controller
$scope.user_id = "5";
$scope.messages = [
{id: 1, body: "Scope User Message", sent_messageable_id: 5},
{id: 2, body: "Other Message", sent_messageable_id: 6}
]
HTML
<div ng-repeat="message in messages">
<div ng-switch on="message.sent_messageable_id">
<div ng-switch-when="user_id">
<!-- should be getting called but never does-->
{{ message.body }}
</div>
<div ng-switch-default>
{{ message.body }}
</div>
<div
</div>
</div>