I assume that the problem with the scope is the reason that the input in this example can change the value next to it, but not another value. If so, how to connect the model to the correct area? If this is not a scale problem, what am I doing wrong?
<html ng-app> <head> <script type="text/javascript" src="angular-1.0.1.min.js"></script> <script type="text/javascript"> function ExampleCtrl($scope) { $scope.list = [ { name: "a" }, { name: "b" }, ]; $scope.value = 5; } </script> </head> <body ng-controller="ExampleCtrl"> <ul ng-repeat="item in list"> <li>{{ item.name }} <ng-switch on="item.name"> <span ng-switch-when="b"> <input type="number" ng-model="value" /> {{ value }} </span> </ng-switch> </li> </ul> value is {{ value }} </body> </html>
Chas. Owens
source share