How to get value in angularjs object attribute

How can I get the value of field.jobtype in a controller?

var app=angular.module('myapp',['ui.bootstrap','']);
    $scope.onStateSelected = function (selectedItem) {
    var state=[{"name":"entry"},{"name":"intermediate"},{"name":"senier"},{"name":"teamlead"}];
    var carearlevel=[{"name":"entry"},{"name":"intermediate"},{"name":"senier"}{"name":"teamlead"}];
<ui-select ng-model="field.jobtype"  theme="select2"  ng-disabled="disabled" class="form-control input-md c-square" on-select="onStateSelected($item)">
  <ui-select-match placeholder="Select a jobtype...">
  <ui-select-choices repeat=" as state in states | filter: $">

Here the ui-select display values from the array sate which is assigned to $scope.states,but when try to display field, jobtype in controller it shows the error jobtype is not defined.


Its working when i used $scope.field. —— in my angularjs controller

Leave a Reply

Your email address will not be published. Required fields are marked *