Note that there are some explanatory texts on larger screens.

plurals
  1. PORefresh MVC view after logging in using Angular
    primarykey
    data
    text
    <p>Working with the Breeze Angular SPA template found here, <a href="http://www.breezejs.com/samples/breezeangular-template" rel="nofollow">http://www.breezejs.com/samples/breezeangular-template</a>, I'm trying to update a menu that changes after user authenticates.</p> <p>My example is slightly different from the default template in that I've moved the Login and Register views into modal windows. When the modal closes after a successful login, the menu, which is in the MVC View (and not the Angular View) does not update as a complete page refresh does not occur.</p> <p>In the SPA template, authentication is required before entering the SPA, then a hard redirect/refresh occurs and the SPA is loaded. In my case, you could be browsing views/pages in the SPA before authenticating.</p> <p><strong>MVC View Code Snippet (Views/Home/Index.cshtml)</strong></p> <pre><code>... &lt;li&gt; @if (@User.Identity.IsAuthenticated) { User Logged In: @User.Identity.Name } else { User Logged In: Annon } &lt;/li&gt;&lt;/ul&gt; &lt;div ng-app="app"&gt; &lt;div ng-view&gt;&lt;/div&gt; &lt;/div&gt; .... </code></pre> <p>I have working the root redirect, after login, the page hard refreshes if json.redirect is set to '/'. However, if its set to the current page, i.e. '#/about', Angular handles the routing and therefore no hard refresh occurs, thus the menu is not updated.</p> <p><strong>Ajax Login Code Snippet (App/ajaxlogin.js)</strong></p> <pre><code>... part of login/register function if (json.success) { window.location = json.redirect || location.href; } else if (json.errors) { displayErrors($form, json.errors); } ... </code></pre> <p>Is this possible to do using my current setup? Or do I need to move the menu somewhere inside the SPA and use Angular to determine what menu to show? If the latter, direction in how to best do this? I'm new to both Angular and Breeze.</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