<div ng-controller="StaticCtrl">
<input type="radio" ng-model="lunch" value="chicken" name="lunch">
<input type="radio" ng-model="lunch" value="beef" name="lunch">
<input type="radio" ng-model="lunch" value="fish" name="lunch">
{{lunch}}
</div>
<hr>
<div ng-controller="DynamicCtrl">
<input type="radio" ng-model="lunch" ng-repeat="m in meat" value="m" name="lunch">
{{lunch}}
</div>
2.- Controller
var myApp = angular.module('myApp',[]);
function StaticCtrl($scope) {
$scope.lunch= 'chicken';
}
function DynamicCtrl($scope) {
$scope.meat = ['chicken', 'beef', 'fish'];
$scope.lunch = 'chicken';
}
3.- Screen - Example
chicken
chicken
No hay comentarios:
Publicar un comentario