Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Executing a route without a template #3138

Closed
logicbomb opened this issue Jul 5, 2013 · 7 comments
Closed

Executing a route without a template #3138

logicbomb opened this issue Jul 5, 2013 · 7 comments

Comments

@logicbomb
Copy link

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/

@ashleygwilliams ashleygwilliams added this to the Backlog milestone Feb 21, 2014
@btford btford removed the gh: issue label Aug 20, 2014
@joseluisq
Copy link

For example when templateUrl is false:

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:

image

Finally the browser tab is frozen.

@caitp
Copy link
Contributor

caitp commented May 8, 2015

well that's messed up and worth investigating, but setting templateUrl to false doesn't accomplish what you want, so why are you doing that? It doesn't mean anything as far as angular is concerned

@joseluisq
Copy link

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.

@caitp
Copy link
Contributor

caitp commented May 8, 2015

Right, but you could just use template: "" to achieve that.

@caitp
Copy link
Contributor

caitp commented May 8, 2015

in particular, setting templateUrl to false will try to resolve the string "false" as a URL, which should be resolved relative to the current location of the frame (which is almost certainly not what you want)

@joseluisq
Copy link

In general I think it should exist a validation for templateUrl.
Thanks, I will try this

@Narretz
Copy link
Contributor

Narretz commented Nov 3, 2016

The problem with having an empty or false templateUrl is tracked here: #12176
Since you can do template: '', it's very easy to have a route "without" a template

@Narretz Narretz closed this as completed Nov 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants