Hi Jen,

If you are trying the console log inside the controller function you should 
use console.log($scope.selectedDiscipline);   This value will be filled 
once we selected the option. Preferably you can use ng-change to call your 
controller function.

Hope this helps.


On Tuesday, 28 March 2017 15:21:22 UTC+5:30, Jen wrote:
>
> i have a form with a <select> populated using ng-options and the ng-model 
> is coming as undefined. the html code is:
>
>       <label ng-controller="disciplineController">
>         Select your discipline
>         <select ng-model="selectedDiscipline" ng-options="discipline for 
> discipline in disciplines" required>
>         </select>
>       </label>
>
> the controller is:
>
> function disciplineController($scope){
>   $scope.disciplines=[
>     "Agriculture",
>     "Anthropology"
>   ]
> };
>
> there are more disciplines i didn't feel the need to paste them all.
>
> when i console.log(selectedDiscipline), it comes up undefined
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to