-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Executing a route without a template #3138
Comments
For example when var app = angular.module('myApp.foo', ['ngRoute']);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/foo', {
templateUrl: false,
controller: 'fooCtrl'
});
}]); Angular loads all controllers again and then the console throws this: Finally the browser tab is frozen. |
well that's messed up and worth investigating, but setting |
Maybe, but sometimes I need angular route doesn't load by default an template. Because I can load manually my custom template and compile it on the fly. |
Right, but you could just use |
in particular, setting |
In general I think it should exist a validation for templateUrl. |
The problem with having an empty or false templateUrl is tracked here: #12176 |
This has been opened and closed a few times
I may have found a use case where it's a valid to execute a route that doesn't have an associated template. Imagine a page that launches various modal windows with the requirement to be able to deep-link directly to the page with a dialog open.
The only difference between the modals are the title & text, so the
$rootScope
is responsible for setting up and launching a modal, and the controller simply provides route specific content.A workaround is to set
{ controller: 'fooCtl', template: ' ' }
, but it'd be nice to leave the template property out altogether.Here's a fiddle that shows the problem and workaround: http://jsfiddle.net/EGfAX/5/
The text was updated successfully, but these errors were encountered: