Last active
January 11, 2016 17:50
-
-
Save icfantv/1d06effd3bcd2106bb83 to your computer and use it in GitHub Desktop.
Modal Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ModalController($scope, $uibModalInstance) { | |
$scope.data = {}; | |
$scope.data.form = {}; | |
$scope.close = function() { | |
$uibModalInstace.close($scope.data.form); | |
} | |
$scope.cancel = function() { | |
$uibModalInstance.dismiss(); | |
} | |
} | |
function EditController($scope) { | |
// do stuff with your edit form but make sure it's bound to $scope.data.form, | |
// or data.form in your view | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h3 class="panel-title"> | |
Some Title | |
</h3> | |
</div> | |
<div class="panel-body"> | |
<div ng-controller="EditController"> | |
<!-- do your editing stuff here, maybe via ng-include to reuse your template--> | |
<!-- make sure you reference your form via `data.form` --> | |
</div> | |
</div> | |
<div class="modal-footer"> | |
<button class="btn btn-primary" | |
ng-disabled="!data.form.$dirty || data.form.$invalid" | |
ng-click="ModalController.save()"> | |
Save | |
</button> | |
<button class="btn btn-danger" ng-click="cancel()">Cancel</button> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment