Angular open controller/view based on server response
<p>I have an Angular application with different types of pages, all identified by a slug right after the base url, so like:</p>

<pre><code>http://example.com/slug-a
http://example.com/slug-b
</code></pre>

<p>Slug a and b are of different types and need to be rendered in a different view. The data belonging to the objects identified by slug a and b is fetched from the server, and the Angular application is supposed to change the view based on the object type.</p>

<p>Is it possible to handle this in the ngRoute's $routeProvider? I can't find any documentation that helps me with this, and I'm sure I'm not the first one to try this..</p>

<p>So, in short:</p>

<ul>
<li>Client requests slug A => Angular requests data from Server => Angular loads ControllerA with template A.</li>
<li>Client requests slug B => Angular requests data from Server => Angular loads ControllerB with template B</li>
</ul>

<p>Different view based on server response.</p>