如何在 angularjs 对象属性中获取值

How to get value in angularjs object attribute

如何在控制器中获取 field.jobtype 的值?

var app=angular.module('myapp',['ui.bootstrap','ui.select']);
app.controller('mycontroller',function($scope){
    $scope.onStateSelected = function (selectedItem) {
        $scope.selectedState=selectedItem.name;
    }
    $scope.oncarearchange=function(item){
        $scope.selectedLocation=item.name;
    }
    var state=[{"name":"entry"},{"name":"intermediate"},{"name":"senier"},{"name":"teamlead"}];
    var carearlevel=[{"name":"entry"},{"name":"intermediate"},{"name":"senier"}{"name":"teamlead"}];
    $scope.states=state;
    $scope.carear=carearlevel;
});
<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...">
    {{$select.selected.name}}
  </ui-select-match>
  <ui-select-choices repeat="state.name as state in states | filter: $select.search">
  {{state.name}}
  </ui-select-choices>
</ui-select>

此处 ui-select 显示分配给 $scope.states 的数组状态的值,但是当尝试显示字段时,控制器中的作业类型显示错误作业类型未定义。

它在我使用 $scope.field 时有效。 ------ 在我的 angularjs 控制器中