R
R
Roman Kuzmenko2016-09-14 22:59:37
Angular
Roman Kuzmenko, 2016-09-14 22:59:37

How to get json in scope?

Hello! Please help. I want to build a select
Using $http.get , I get the following JSON:

{ value: "0", name: "Pendiente" },
{ value: "1", name: "Em andamento" },
{ value: "2", name: "Erro" },
{ value: "3", name: "Enviar email" },
{ value: "4", name: "Enviado" }

Next
$scope.xxx = angular.fromJson(response);
In template
<select ng-model="bazis" ng-options="bazis as bazis.name for bazis in xxx"></select>

I get some undefined, here's what:
<select ng-model="bazis" ng-options="bazis as bazis.name for bazis in xxx">
<option value="string:[" label="undefined" selected="selected"></option>
<option value="string:{" label="undefined"></option>
<option value="string:&quot;" label="undefined"></option>
<option value="string:v" label="undefined">
...
</select>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepanya, 2016-09-19
@Stepanya

ng-model="bazis" ng-options="bazis as bazis.name for bazis in xxx"

you have a problem with variable names

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question