Skip to content

Commit 255cfda

Browse files
committed
(feat) Move templates handle to the angular-meteor-templates
1 parent 26b40d0 commit 255cfda

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

packages/angular-meteor-data/angular-meteor.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,6 @@ var angularMeteor = angular.module('angular-meteor', [
1212
'angular-meteor.reactive'
1313
]);
1414

15-
angularMeteor.config([
16-
'$provide',
17-
function ($provide) {
18-
var templatesFileExtension = ['html', 'tpl', 'tmpl', 'template', 'view'];
19-
20-
$provide.decorator('$templateCache', ['$delegate', function($delegate) {
21-
var originalGet = $delegate.get;
22-
23-
$delegate.get = function(templatePath) {
24-
var originalResult = originalGet(templatePath);
25-
26-
if (angular.isUndefined(originalResult)) {
27-
var fileExtension = ((templatePath.split('.') || []).pop() || '').toLowerCase();
28-
29-
if (templatesFileExtension.indexOf(fileExtension) > -1) {
30-
throw new Error('[angular-meteor][err][404] ' + templatePath + ' - HTML template does not exists!');
31-
}
32-
}
33-
34-
return originalResult;
35-
};
36-
37-
return $delegate;
38-
}]);
39-
}
40-
]);
41-
4215
angularMeteor.run(['$compile', '$document', '$rootScope', function ($compile, $document, $rootScope) {
4316
// Recompile after iron:router builds page
4417
if(Package['iron:router']) {

packages/angular-templates/package.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ Package.registerBuildPlugin({
3030
Package.onUse(function(api) {
3131
api.versionsFrom('[email protected]');
3232
api.use('isobuild:[email protected]');
33+
api.use('angular-meteor-data', { weak: true });
34+
35+
api.addFiles('templates-handler.js', 'client');
3336
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
angular.module('angular-meteor').config([
2+
'$provide',
3+
function ($provide) {
4+
var templatesFileExtension = ['html', 'tpl', 'tmpl', 'template', 'view'];
5+
6+
$provide.decorator('$templateCache', ['$delegate', function($delegate) {
7+
var originalGet = $delegate.get;
8+
9+
$delegate.get = function(templatePath) {
10+
var originalResult = originalGet(templatePath);
11+
12+
if (angular.isUndefined(originalResult)) {
13+
var fileExtension = ((templatePath.split('.') || []).pop() || '').toLowerCase();
14+
15+
if (templatesFileExtension.indexOf(fileExtension) > -1) {
16+
throw new Error('[angular-meteor][err][404] ' + templatePath + ' - HTML template does not exists!');
17+
}
18+
}
19+
20+
return originalResult;
21+
};
22+
23+
return $delegate;
24+
}]);
25+
}
26+
]);

0 commit comments

Comments
 (0)