Answer the question
In order to leave comments, you need to log in
Why is the data not being submitted in the form?
Making a multi-window form
<form ng-submit="form.processForm()" name="form.formData" novalidate>
<h1>Sign Up</h1>
<div ui-view></div>
</form>
"form.formData.group2
. After choosing in it, redirection to the next state occurs with the completion of registration. "form.formData.group2
in form.formData does not get. Why? vm.showModal = function(ev) {
$mdDialog.show({
templateUrl: 'dialog.html',
parent: angular.element(document.body),
targetEvent: ev,
controller: function DialogController($mdDialog) {
var vm = this;
vm.closeDialog = function() {
$mdDialog.hide();
$state.go("form.credential");
};
},
controllerAs: 'dc'
});
}
in the window<md-dialog>
<div layout="row" layout-align="start start">
<md-radio-group ng-model="form.formData.group2">
<md-radio-button value="resident">Resident</md-radio-button>
<md-radio-button value="nonresident">Non resident</md-radio-button>
</md-radio-group>
<a class="md-button" ng-click="dc.closeDialog()">Next</a>
</div>
</md-dialog>
$submitted: true
$valid: true
address: "Mars"
group1: "company"
password: "123456"
username: "[email protected]"
Object {$$parentForm: Object, $error: Object, $$success: Object, $pending: undefined, $name: "form.formData"…}
Answer the question
In order to leave comments, you need to log in
1. Display the ability to select the type of organization right in the same form where the user selects whether he is an individual or an organization. ng-if to the rescue.
2. You should not call the dialog box, and if you do, make a cancel button.
3. In the Angular Material dialogs, your $scope. For proper processing, use the following code:
$mdDialog.show({
templateUrl: '/template/dialog.html',
controller: [ '$scope', '$mdDialog', function($scope, $mdDialog){
$scope.cancel = $mdDialog.cancel; // Отмена. Ничего сложного.
$scope.save = function(){
$mdDialog.hide($scope.model); // Диалог закрывается, promise разрешается моделью
};
}]
}).then(function (model) {
// Та самая модель, которую возвращает $mdDialog.
// При использовании метода cancel() выполняет код для reject
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question