1
I have a list of Radium Buttons fields and need to control by angular: Validations: one option at a time and display message.
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div>
<label>1. As imagens estão legíveis?</label><br class="clear">
<div class="btn-option">
<input class="bt-yes" type="radio" id="legivelsim" name="legivelsim" value="true" ng-model="checklist.passo" ng-click="adicionar(checklist.passo)">
<label class="bt-yes" for="legivelsim">SIM</label>
</div>
<div class="btn-option">
<input class="bt-no" type="radio" id="legivelnao" name="legivelnao" value="false" ng-model="checklist.passo" ng-click="adicionar(checklist.passo)">
<label class="bt-no" for="legivelnao">NÃO</label>
</div>
</div>
<div>
<label>2. Documento de Identificação está na <a>Política de Documentos</a> ?</label><br class="clear">
<div class="btn-option">
<input class="bt-yes" type="radio" id="docsim" name="docsim" value="true" ng-model="checklist.passo" ng-click="adicionar(checklist.passo)">
<label class="bt-yes" for="bt2">SIM</label>
</div>
<div class="btn-option">
<input class="bt-no" type="radio" id="docnao" name="docnao" value="false" ng-model="checklist.passo" ng-click="adicionar(checklist.passo)">
<label class="bt-no" for="btn2">NÃO</label>
</div>
</div>
<div>
<label>3. Documento de Identificação está dentro do prazo de validade? Dúvida na análise documental? <a>Clique Aqui.</a></label><br class="clear">
<div class="btn-option">
<input class="bt-yes" type="radio" id="validadesim" name="validadesim" value="true" ng-model="checklist.passo" ng-click="adicionar(checklist.passo)">
<label class="bt-yes" for="bt3">SIM</label>
</div>
<div class="btn-option">
<input class="bt-no" type="radio" id="validadenao" name="validadenao" value="false" ng-model="checklist.passo" ng-click="adicionar(checklist.passo)">
<label class="bt-no" for="btn3">NÃO</label>
</div>
</div>
</body>
</html>
How can I get the value imput radio ??
– alexjosesilva
@alexjosesilva is already in
angular
that is$scope.checklist
has the four true and false values, get it? how are you usingangular
there are values!– novic
var vm = $Scope; vm.add = Function(vm){ vm.Checklist = { question1: false, Pergunta2 : false, question3 : false }; vm.Submit = Function() { console.log(vm.Checklist); }; ; };
– alexjosesilva
I’m getting the message: Typeerror: Cannot set Property 'Checklist' of Undefined
– alexjosesilva
$scope.checklist
would be so! correct, you cannot use Function(vm) without passing the variable! @alexjosesilva. What do you want to do with the values?– novic
This is my angular.module controler cabacelho('portalvarejistaApp.mesaAnalise'). controller('Mesaanalisepropostacontroller', Function ($Scope) { var vm = $Scope;
– alexjosesilva
@alexjosesilva, OK ...
vm
receives$scope
and ? now be in doubt what is your other doubt?– novic
yes...vm gets $Scope
– alexjosesilva
how I handle it inside the controller ??
– alexjosesilva
@alexjosesilva saw himself my example?
– novic
Let’s go continue this discussion in chat.
– novic