mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
93 lines
3.2 KiB
HTML
93 lines
3.2 KiB
HTML
<html ng-app="modalTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Modal</title>
|
|
|
|
<!-- Sets initial viewport load and disables zooming -->
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-touch.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-animate.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-sanitize.js"></script>
|
|
<script src="../../../../dist/js/ionic.js"></script>
|
|
<script src="../../../../dist/js/ionic-angular.js"></script>
|
|
</head>
|
|
<body>
|
|
<pane ng-controller="ModalCtrl">
|
|
<header-bar type="bar-positive" title="'Contacts'" right-buttons="contactsRightButtons">
|
|
</header-bar>
|
|
<content has-header="true">
|
|
<list>
|
|
<item ng-repeat="contact in contacts">
|
|
{{contact.name}}
|
|
</item>
|
|
</list>
|
|
</content>
|
|
</pane>
|
|
|
|
<script id="modal.html" type="text/ng-template">
|
|
<div class="modal">
|
|
<header class="bar bar-header bar-positive">
|
|
<h1 class="title">New Contact</h1>
|
|
<button class="button button-clear button-primary" ng-click="closeModal()">Cancel</button>
|
|
</header>
|
|
<content has-header="true">
|
|
<div class="padding">
|
|
<div class="list">
|
|
<label class="item item-input">
|
|
<span class="input-label">First Name</span>
|
|
<input type="text" placeholder="">
|
|
</label>
|
|
<label class="item item-input">
|
|
<span class="input-label">Last Name</span>
|
|
<input type="text" placeholder="">
|
|
</label>
|
|
<label class="item item-input">
|
|
<span class="input-label">Email</span>
|
|
<input type="text" placeholder="">
|
|
</label>
|
|
<button class="button button-full button-positive" ng-click="closeModal()">Create</button>
|
|
</div>
|
|
</div>
|
|
</content>
|
|
</div>
|
|
</script>
|
|
|
|
<script>
|
|
angular.module('modalTest', ['ionic'])
|
|
|
|
.controller('ModalCtrl', function($scope, Modal) {
|
|
$scope.contacts = [
|
|
{ name: 'Gordon Freeman' },
|
|
{ name: 'Barney Calhoun' },
|
|
{ name: 'Lamarr the Headcrab' },
|
|
];
|
|
$scope.contactsRightButtons = [
|
|
{
|
|
type: 'button-icon',
|
|
content: '<i class="icon ion-compose"></i>',
|
|
click: function(e) {
|
|
$scope.openModal();
|
|
}
|
|
}
|
|
];
|
|
$scope.openModal = function() {
|
|
$scope.modal.show();
|
|
};
|
|
$scope.closeModal = function() {
|
|
$scope.modal.hide();
|
|
};
|
|
Modal.fromTemplateUrl('modal.html', function(modal) {
|
|
$scope.modal = modal;
|
|
}, {
|
|
scope: $scope,
|
|
animation: 'slide-in-up'
|
|
});
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|