Skip to content

Commit 81fda54

Browse files
committed
Added error message in silent fail condition
Unfortunately time has been sparse and this is a low priority. I haven't tested it as thoroughly as I'd like, but wanted to follow through on the pull request offered in angular-ui#330 (comment). Hopefully this will help others trying the same thing and getting silent errors.
1 parent ae7e0cb commit 81fda54

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/templateFactory.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,19 @@ function $TemplateFactory( $http, $templateCache, $injector) {
3838
* that string,or `null` if no template is configured.
3939
*/
4040
this.fromConfig = function (config, params, locals) {
41-
return (
42-
isDefined(config.template) ? this.fromString(config.template, params) :
41+
var template = isDefined(config.template) ? this.fromString(config.template, params) :
4342
isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :
4443
isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :
45-
null
46-
);
44+
null;
45+
46+
if (template === null) {
47+
throw new Error("template, templateUrl, or templateProvider must be defined.");
48+
}
49+
50+
return template;
4751
};
4852

53+
4954
/**
5055
* @ngdoc function
5156
* @name ui.router.util.$templateFactory#fromString

0 commit comments

Comments
 (0)