Note that there are some explanatory texts on larger screens.

plurals
  1. POAngular UI Router - Views in an Inherited State
    primarykey
    data
    text
    <p><strong>edit:</strong> Based on the answer by @actor2019 I want to update my question to better explain the problem:</p> <p>Using <a href="https://github.com/angular-ui/ui-router" rel="nofollow noreferrer">Angular UI-Router</a>(v0.0.2), I've setup the app to properly navigate between main "pages"/state, while inheriting the base state.</p> <p><strong>Index.html:</strong></p> <pre><code>&lt;div ui-view&gt;&lt;/div&gt; </code></pre> <p><strong>base.html:</strong></p> <pre><code>&lt;!-- Header --&gt; &lt;div&gt; &lt;!-- Header markup --&gt; &lt;!-- Search View --&gt; &lt;div ui-view="search"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!-- Page Content view --&gt; &lt;div ui-view&gt;&lt;/div&gt; </code></pre> <p>The issue is here in the app.js file. When I add the <code>views</code> parameter to the <code>base</code> state, everything stops working(100% blank page). Without that parameter, the page renders correctly, but I have no search view.</p> <p><strong>app.js:</strong></p> <pre><code>$urlRouterProvider.otherwise('/'); // // Now set up the states $stateProvider .state('base', { abstract: true, templateUrl: 'views/base.html', views: { "search": { templateUrl: "views/search.html" } } }) .state('base.home', { url: "/", templateUrl: "views/home.html" }) .state('base.page2', { url: "/page2", templateUrl: "views/page2.html" }); </code></pre> <p><strong>How do I add views to this parent 'base' state?</strong></p> <p><img src="https://i.stack.imgur.com/Y2VQR.png" alt="enter image description here"></p> <p><strong>UPDATE:</strong> The problem with @actor2019's answer <a href="https://stackoverflow.com/a/18504504/229780">here</a> is that the <code>search</code> view gets reinitialized when the state changes. I'd like the views off the base level to persist through state changes.</p>
    singulars
    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.
 

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