0

I can't get the value selected when i press the "enviar" button this is my code i made a edit ths snippet is working but not this code the console.log is showing always "sugerencias"

html

            <ion-content class="has-header has-subheader">
    <button ng-click="im(seleccionado)">sdaodisa</button>
    <form>
        <div>
            <label class="item item-select">
                <span class="input-label">Asunto</span>
                <select ng-model="seleccionado" ng-options="item for item in arrayj"></select>

            </label>
        </div>

    </form>
</ion-content>

js

var app = angular.module('starter');

app.controller('controladorSugerencias', function ($scope) {

    $scope.arrayj = ['sugerencias', 'reclamos'];
    $scope.seleccionado = $scope.arrayj[0];

    $scope.im = function () {
        console.log($scope.seleccionado)
    };

});
Ivan Paredes
  • 465
  • 2
  • 5
  • 20
  • 3
    this works fine: http://plnkr.co/edit/3VHXOAlKScWElgU43o7X?p=preview/. However, `seleccionado` is a primitive, and is subject to scope inheritance issues, particularly if this code was wrapped inside something else like an `ng-repeat` or `ng-if\show\hide`. **ALWAYS** use a dot in angular bindings. see : http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs – Claies Oct 19 '16 at 18:30
  • Can you add a simple working version of your code in the code snippet? :) – Sreekanth Oct 19 '16 at 18:31

0 Answers0