mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Working modal stuff
This commit is contained in:
38
dist/ionic-angular.js
vendored
38
dist/ionic-angular.js
vendored
@ -2,6 +2,44 @@ angular.module('ionic.ui', ['ionic.ui.content', 'ionic.ui.tabs', 'ionic.ui.nav',
|
||||
;
|
||||
;
|
||||
;
|
||||
angular.module('ionic.service.modal', ['ionic.service'])
|
||||
|
||||
|
||||
.factory('Modal', ['$rootScope', '$document', '$compile', 'TemplateLoader', function($rootScope, $document, $compile, TemplateLoader) {
|
||||
return {
|
||||
/**
|
||||
* Load a modal with the given template string.
|
||||
*
|
||||
* A new isolated scope will be created for the
|
||||
* modal and the new element will be appended into the body.
|
||||
*/
|
||||
fromTemplate: function(templateString) {
|
||||
// Create a new isolated scope for the modal
|
||||
var scope = $rootScope.$new(true);
|
||||
|
||||
// Compile the template
|
||||
var element = $compile(templateString)(scope);
|
||||
$document[0].body.appendChild(element[0]);
|
||||
|
||||
return new ionic.views.Modal({el: element[0] });
|
||||
},
|
||||
fromTemplateUrl: function(url, cb) {
|
||||
TemplateLoader.load(url).then(function(templateString) {
|
||||
// Create a new isolated scope for the modal
|
||||
var scope = $rootScope.$new(true);
|
||||
|
||||
// Compile the template
|
||||
var element = $compile(templateString)(scope);
|
||||
$document[0].body.appendChild(element[0]);
|
||||
|
||||
var modal = new ionic.views.Modal({ el: element[0] });
|
||||
|
||||
cb(modal);
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
;
|
||||
angular.module('ionic.service', [])
|
||||
|
||||
.factory('TemplateLoader', ['$q', '$http', '$templateCache', function($q, $http, $templateCache) {
|
||||
|
||||
Reference in New Issue
Block a user