mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
22 lines
511 B
JavaScript
22 lines
511 B
JavaScript
angular.module('ionic.service.templateLoad', [])
|
|
|
|
.factory('$ionicTemplateLoader', ['$q', '$http', '$templateCache', function($q, $http, $templateCache) {
|
|
return {
|
|
load: function(url) {
|
|
var deferred = $q.defer();
|
|
|
|
$http({
|
|
method: 'GET',
|
|
url: url,
|
|
cache: $templateCache
|
|
}).success(function(html) {
|
|
deferred.resolve(html && html.trim());
|
|
}).error(function(err) {
|
|
deferred.reject(err);
|
|
});
|
|
|
|
return deferred.promise;
|
|
}
|
|
};
|
|
}]);
|