我有一个开放的模态,并将信息放入其中。如果单击“保存”,则存储信息并关闭模态。所有工作,但如果我尝试在模态关闭之后或之前更改位置它不起作用。如果你取出$ modalInstance.close位置变化有效,但你仍然坚持使用dumpy模式:[为什么?
控制器部件:
var onSaveFinished = function (result) {
$scope.$emit('quiverApp:customerProfileUpdate', result);
$modalInstance.close(result);
$location.path('/rentalAgreements/new');
};
$scope.save = function () {
if ($scope.customerProfile.id != null) {
CustomerProfile.update($scope.customerProfile, onSaveFinished);
} else {
CustomerProfile.save($scope.customerProfile, onSaveFinished);
}
};
模态部分:
<form name="editForm" role="form" novalidate ng-submit="save()" show-validation>
<div class="modal-header" id="goAwayy">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="clear()">×</button>
<h4 class="modal-title" id="myCustomerProfileLabel">
<span ng-show="state.is('customerProfile.new')">Create a Customer Profile</span>
<span ng-show="state.is('customerProfile.edit')">Edit the Profile of {{customerProfile.firstName + ' ' + customerProfile.lastName }}</span></h4>
</div>
<div class="modal-body">
<div class="col-xs-12 col-sm-6 pull-left form-group">
<label class="control-label" for="field_firstName">First Name</label>
<input type="text" class="form-control" name="firstName" id="field_firstName"
ng-model="customerProfile.firstName"
>
</div>
<button type="submit" ng-disabled="editForm.$invalid || editForm.$submitted" class="btn btn-success">
<span class="glyphicon glyphicon-save"></span> <span>Save</span>
</button>
</div>
</form>