Hi everyone I have 1 form with multiple controller with multiple md-autocomplete from mongodb and md-datepicker with($watch) for dinamic min,max day in angular-meteor app I have problem with submit form and get the value of md-autocomplete & md-datepicker :
`<form ng-controller="SubmitCtrl" style="padding-left: 120px;" ng-submit="submit()" name="Form">
<div ng-controller="datesCtrl as vm" ng-form name="DateForm" id="myDatePicker">
<md-input-content>
<md-datepicker
onkeydown="return false"
name="myDate"
ng-model="myDate"
md-hide-icons="all"
md-current-view="year"
md-min-date="ctrl.minDate"
md-max-date="ctrl.maxDate"
md-open-on-focus="true">
</md-datepicker>
</md-input-content>
{{myDate | date: "yyyy-MM-dd"}}
</div>
<div ng-controller="Nationality as vm" class="form-group" ng-form name="NationalityForm">
<md-input-content id="myDatePicker">
<md-autocomplete flex
md-input-name="NationalityField"
ng-model="NationalityField"
md-input-minlength="3"
md-no-cache="true"
md-selected-item="selectedItem"
md-search-text="searchText"
md-items="item in vm.getMatches(searchText)"
md-item-text="item.country_name"
md-floating-label="Nationality">
<md-item-template>
<span>{{item.country_name}} -</span>
<span
md-highlight-text="vm.searchText"
md-highlight-flags="^i">{{item.country_code_2_letter}}</span>
</md-item-template>
</md-autocomplete>
<p>country:{{selectedItem.country_name + selectedItem.country_code_2_letter}}</p>
</md-input-content>
`
my value is available in each controller separately and I can console.log :
console.log($scope.selectedItem);
and my submit controller is :
angular.module('GntApp')
.controller('SubmitCtrl', ['$scope', function($scope) {
$scope.list = [];
$scope.submit = function(){
if ($scope.test) {
$scope.list.push(this.test);
console.log($scope.test);
}
if ($scope.myDate) {
$scope.list.push(this.myDate);
console.log($scope.$parent.myDate);
}
I know its wrong but as I read I should get value from another controller with parent child but I cannot find good documentation for it I even try angular.element :
$scope.Date = angular.element(myDatePicker);
console.log($scope.Date);
but still not working any suggestion or example will save my day .