feat(ionModalView): ion-modal-view to wrap template instead of <div class="modal">

Closes #1668.

`<div class="modal">` will still work, but adding an `<ion-modal-view>`
element to wrap a modal template is a more "Ionic Looking" way of doing
the same thing.
This commit is contained in:
Andrew
2014-07-07 13:43:12 -06:00
parent b7f45e7ca5
commit ed4f22889e
4 changed files with 17 additions and 6 deletions

9
js/angular/directive/modalView.js vendored Normal file
View File

@@ -0,0 +1,9 @@
IonicModule
.directive('ionModalView', function() {
return {
restrict: 'E',
compile: function(element, attr) {
element.addClass('modal');
}
};
});

View File

@@ -8,7 +8,8 @@
*
* The Modal is a content pane that can go over the user's main view
* temporarily. Usually used for making a choice or editing an item.
* Note that you need to put the content of the modal inside a div with the class `modal`.
*
* Put the content of the modal inside of an `<ion-modal-view>` element.
*
* Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating
* scope, passing in itself as an event argument. Both the modal.removed and modal.hidden events are
@@ -17,14 +18,14 @@
* @usage
* ```html
* <script id="my-modal.html" type="text/ng-template">
* <div class="modal">
* <ion-modal-view>
* <ion-header-bar>
* <h1 class="title">My Modal title</h1>
* </ion-header-bar>
* <ion-content>
* Hello!
* </ion-content>
* </div>
* </ion-modal-view>
* </script>
* ```
* ```js
@@ -76,7 +77,7 @@ function($rootScope, $document, $compile, $timeout, $ionicPlatform, $ionicTempla
* @description
* Instantiated by the {@link ionic.service:$ionicModal} service.
*
* Hint: Be sure to call [remove()](#remove) when you are done with each modal
* Be sure to call [remove()](#remove) when you are done with each modal
* to clean it up and avoid memory leaks.
*
* Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating

View File

@@ -21,6 +21,7 @@
}
.modal {
display: block;
position: absolute;
top: 0;
z-index: $z-index-modal;

View File

@@ -38,7 +38,7 @@
</ion-pane>
<script id="modal.html" type="text/ng-template">
<div class="modal" ng-controller="ModalCtrl">
<ion-modal-view ng-controller="ModalCtrl">
<ion-header-bar>
<h1 class="title">New Contact</h1>
<button class="button button-positive" ng-click="hideModal()">Close</button>
@@ -65,7 +65,7 @@
</div>
</div>
</ion-content>
</div>
</ion-modal-view>
</script>
<script>