Switching between views on same controller

I've got a page that says "GENERATE", and it has a form on it. And then you submit the form by pressing the Generate button, and I want it to take you to a new view called "LOADING" whilst it waits for the result to come back from the server, then when the response comes back successfully I want it to take you to a "SHARE" page that allows you to share what you get back. This flow is all on 1 controller/route:


At the moment my routes look like so:

.config(function ($routeProvider) {
  .when('/', {
    templateUrl: 'views/main.html',
    controller: 'MainCtrl'
  .when('/create', {
    templateUrl: 'views/create.html',
    controller: 'CreateCtrl'
    redirectTo: '/'


How can I do this view switching behavior, or what is the most recommended way to do it? If the response is an error I want to go back to the create page for example as well, so I need that sort of control.

Thank you!


Consider useing ui-router:

UI-Router for Nested Routing by the AngularUI Team!

Sample: http://angular-ui.github.io/ui-router/sample/

Need Your Help

How can I capture audio input from 2 mics of my android phone real time and simultaneously

android eclipse signal-processing audio-recording microphone

I have a requirement where I need audio from both the mics on my android phone simultaneously in order to do some signal processing using Eclipse. Do you think it is possible to do this? Also can you