Working modal stuff

This commit is contained in:
Max Lynch
2013-10-04 17:47:54 -05:00
parent e8d76af832
commit c338f75882
12 changed files with 214 additions and 95 deletions

38
dist/ionic-angular.js vendored
View File

@ -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) {