1
In the ion-radio
has the ng-value
with 2 values. The ng-model
is taking the value of ng-value
. The problem here is that I want to display these 2 values of ng-value
separate.
ex: {{data.nomeOpc}}
displays option name, and {{data.valorOpc}}
displays the option value. In this model it displays the 2 together and I want to separate the values. I appreciate the help
<ion-list>
<h3>Opções</h3>
<ion-radio ng-repeat = "child in produto.opcoes" value = "{{child}}" ng-change = "pegar(data)" ng-model = "data.opcoes">
<strong>{{child.nomeOpc}}
<span> = {{child.valorOpc | currency: 'R$'}}</span>
</strong>
</ion-radio>
</ion-list>
Below is the function in the controller
$scope.pegar = function(data) {
$scope.data = JSON.parse(data.opcoes);
console.log($scope.data)
console.log($scope.data.id, $scope.data.nomeOpc);
}
opa...worked right here.. he returned as his example. Now how do I separate these values into $Scope separately. When I click on an option on the console it returns: Object {idOpc: "66", nameOpc: "01 person", valueOpc: "26.50"}
– Alexandre Scrideli
ex:
$scope.item.idOpc
,$scope.item.nomeOpc
– DiegoAugusto
I edited the example I posted, from a look.
– DiegoAugusto
guy...worked out tbm the example q vc passed me. They separated by Scope. More now from giving an error q I think beast, more do not know. When I switched to the last code you gave me, the radio checked symbol no longer appears. It takes the value no longer appears the checked symbol.
– Alexandre Scrideli
I updated the code according to what you went through. @Techies
– Alexandre Scrideli
@Alexandrescrideli I edited the answer and added an example working with Ionic
– DiegoAugusto
I set up a structure in the codepen, with the 2 examples you gave me. The last example solves the problem of the checked bug, but we can’t show which option set in a scope. Here follows the codepen link. http://codepen.io/alexandre_developer/pen/JXPwdd?editors=1011 @Techies
– Alexandre Scrideli
From to show in scope yes, just assign the date variable to a $Scope
– DiegoAugusto
@Alexandrescrideli I edited the answer, take a look at the codepen link
– DiegoAugusto
Note: In the code of the use ng-click button instead of ng-change
– DiegoAugusto
Brother sorry for the delay of the answer. Your code helped me a lot and I could understand a lot here, just reading your code.... thanks for the help anyway. @Techies
– Alexandre Scrideli
@Alexandrescrideli worked out?
– DiegoAugusto
Gave yes @Techies. With your code, I learned several things q did not know. You helped me pakas mine. Thanks even
– Alexandre Scrideli
I opened a new question here, if you can help me, I’d appreciate it very much myself. The link is http://answall.com/questions/116194/fun%C3%A7%C3%A3o-get-no-service-js-retorna-null? noredirect=1#comment242386_116194
– Alexandre Scrideli
Opa, good that it worked @Alexandrescrideli, continue programming and good luck. Don’t forget to mark the answer as correct so it helps other users with the same problem.
– DiegoAugusto
I know q is a mistake beast pakas, but I don’t know much programming. I’m more Dialing, so I’m learning little by little.
– Alexandre Scrideli
I’ll take a look at her
– DiegoAugusto
Thank you very much, brother...
– Alexandre Scrideli