How can I get the value of an HTML form to pass to JavaScript and check required field but form and modal check requried in different page HTML
mainpage.html
<html>
<div ng-controller="mainController">
<button ng-click="action()">action</button>
<div ng-include="formData.html'" ></div>
</div>
</html>
formData.html
<html>
<div ng-controller="formController">
<form name="form" role="form" novalidate="novalidate">
<div>
<label for="name">Name</label>
<div>
<input ng-required="true" ng-model="data.name" id="name" name="name" />
</div>
</div>
<div>
<label for="age">Age</label>
<div>
<input ng-required="true" ng-model="data.age" id="age" name="age" />
</div>
</div>
<div>
<button ng-click="save(form)">Save</button>
</div>
</form>
</div>
</html>
actionController.html
<html>
<div ng-controller="actionController">
<div>
<button ng-click="next()">Next</button>
</div>
</div>
</html>
controller.js
app.controller('mainController', [{
$scope.action = function (action) {
$modal.open({
templateUrl: 'actionController.html',
controller: 'actionController'
resolve: {
params: function () {
return {};
}
}
})
}
}]);
app.controller('formController', [{
$scope.save = function (form) {}
}]);
app.controller('actionController', [{
$scope.next = function () {
// .... get data and check required data (form in formData.html)
}
}]);
in function next How I can check form required field if from in formData.html Thank you.