Note that there are some explanatory texts on larger screens.

plurals
  1. POAngular best way to handle email confirm route
    primarykey
    data
    text
    <p>I'm trying to work out the best way to define a route that users will click on in the confirmation email that they receive. </p> <p>I have defined a path like this.</p> <pre><code>app.config(function ($routeProvider, $locationProvider, $httpProvider) { $routeProvider.when('/app/setup/confirm/:code',{ // code is $routeParams.code }); }); </code></pre> <p>What needs to happen is:</p> <ul> <li>Make a $http call to the api resource that logs the code as being clicked and confirms email address</li> <li>Log the user in for both the api and front end</li> <li>Return the user to the next step of the setup process now their email is confirmed.</li> <li>If the code is bogus and the $http call returns false then redirect them to the signup page.</li> </ul> <p>As this route doesn't need a template, I can't work out where to put the code to do this. If I only defined a controller it never gets instantiated until I also define a template?? </p> <p>For example this works</p> <pre><code>app.config(function ($routeProvider, $locationProvider, $httpProvider) { $routeProvider.when('/app/setup/confirm/:code',{ controller: function($routeParams){ console.log($routeParams.code); }, template: function(){ return '&lt;html&gt;&lt;/html&gt;'; } }); }); </code></pre> <p>But as soon as I remove the <code>template</code> or even return an empty string in the template the controller doesn't work. There must be right way to do this and this doesn't feel like it.</p> <p>Can anyone give me a pointer? I'm using v1.1.2. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload