From 498365f219f65d6c29bdf2f03610a4d3646009bb Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 27 Dec 2013 20:25:51 -0500 Subject: fix(ngRoute): instantiate controller when template is empty Before this change, $route controllers are not instantiated if the template is falsy, which includes the empty string. This change tests if the template is not undefined, rather than just falsy, in order to ensure that templates are instantiated even when the template is empty, which people may have some reason to do. This "bug" was reported in http://robb.weblaws.org/2013/06/21/angularjs-vs-emberjs/, as a "gotcha" for AngularJS / ngRoute. Closes #5550 --- src/ngRoute/directive/ngView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ngRoute/directive') diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js index b1252944..0ae1c4fc 100644 --- a/src/ngRoute/directive/ngView.js +++ b/src/ngRoute/directive/ngView.js @@ -199,7 +199,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) { var locals = $route.current && $route.current.locals, template = locals && locals.$template; - if (template) { + if (angular.isDefined(template)) { var newScope = scope.$new(); var current = $route.current; -- cgit v1.2.3