I have form with a few fields, but all fields are present in form object and field with name sector is not present. Why? And how I should fix it?
<form name="candidateForm" ng-submit="submitForm()">
<div class="item item-top">
<label>{{'Company'|translate}}*</label>
<input company-autocompleter class="companyAutocompleterOuterSelect"
ng-maxlength="100" name="company" ng-model="candidate.company"
type="text" ng-change="progressUpdate()" required>
<div class="alert alert-danger"
ng-show="candidateForm.company.$invalid && !candidateForm.company.$pristine && candidateForm.company.$error.required == true">
{{'Enter a company'|translate}}
</div>
</div>
<div class="item industry">
<label>{{'Sector'|translate}}*</label>
<input sector-autocomplete name="sector" type="text"
class="select2-container form-control input-lg select2 select14 widthSelectInput1"
required>
<div class="alert alert-danger"
ng-show="candidateForm.sector.$invalid && !candidateForm.sector.$pristine && candidateForm.sector.$error.required">
{{'Enter a sector'|translate}}
</div>
</div>
</form>
So, field company is present in object, but sector is not
I am not using ng-model because sector is setting inside directive:
element.select2({
minimumInputLength: 0,
placeholder: $translate.instant('Sector'),
allowClear: true,
data: translatedSectors,
dropdownCssClass: "bigdrop"
}).unbind("change").on("change", function(e) {
if(e.added) {
if($scope.candidate) {
$scope.candidate.sector = e.added.id;
$scope.progressUpdate();
} else {
if($scope.client) {
$scope.client.sector = e.added.id;
}
}
} else {
if($scope.candidate) {
$scope.candidate.sector = '';
} else {
if($scope.client) {
$scope.client.sector = '';
}
}
}
})