the ng-model I'm using in my HTML contains a dot. Let's take a closer look
step1.html file
<div class="col-xs-12 col-sm-9">
<select id="plateId" ng-model="selectedPlate.plate" ng-options="plate.id as (plate.wafer_id + ' - ' + plate.serial_number) for plate in plates" />
<option value="">Select</option>
</select>
</div>
This is simply a form-wizard using ui-router.
In my other HTML file, the user presses a button in step 3.
<button class="btn btn-success btn-next" ng-click="storePlatesInspection()">
Submit
<i class="ace-icon fa icon-on-right"></i>
</button>
And here is my controller.
angular.module('sxroApp')
.controller('plateInspectionCtrl', function ($scope, PlatesInspectionFactory, PlatesFactory, PlateQualityFactory, EquipmentStatusCodesFactory, PlateContainersFactory, $location) {
// object to hold all the data for plate inspection
$scope.data = [];
$scope.selectedPlate = {};
$scope.inspectionData = {
equipment_status_codes_id: 1,
plate_container_id: 1,
plate_container_slot: 34,
plate_quality_id: 1
}
PlatesFactory.query(function (plates) {
$scope.plates = plates;
});
/* $scope.getSelectedPlate = function(plate)
{
$scope.data.push({
plate_id : plate.id
});*/
// console.log($scope.selectedPlate.id)
//alert(item.wafer_id)
//PlatesInspectionFactory.update( {id : $scope.plateid[0].plate_id}, $scope.inspectionData)
PlateQualityFactory.query(function (platequality) {
$scope.platequality = platequality;
})
PlateContainersFactory.query(function (plateContainers) {
$scope.plateContainers = plateContainers;
});
EquipmentStatusCodesFactory.query(function (statuscodes) {
$scope.statuscodes = statuscodes;
});
$scope.storePlatesInspection = function () {
alert($scope.selectedPlate.plate.id); // not working
alert($scope.selectedPlate.plate.$id); // not working
}
});
I also attempted
alert($scope.selectedPlate.plate); // undefined is the result.
I followed the advice provided in this article
Ng-model does not update controller value
Can anyone point out what I might be doing wrong?
here is an image of the form form
I am attempting to use the model to capture the user's selection during the wizard process.
update #1: I have made some updates to the code above.