ng-if/ng-switch breaks ng-model? No, it’s just a matter of understanding scopes

Lately I’ve been working on an AngularJS project, and I incurred on something that at first I considered a bug. Here’s some example code: <script src=”//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js”></script> <script>// <![CDATA[ function MyCtrl ($scope){ $scope.showMySelect = true; $scope.opts = [1,2,3]; $scope.mySelectValue = 2; } // ]]></script> <div><section>{{mySelectValue}} <select></select></section></div> I wanted to update $scope.mySelectValue with the selected value in […]