Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>The first obvious mistake:</h2> <p>You can't specify controller and template on the state while your using views. They are mutually exclusive...</p> <p>This is because when there is no "views" but a controller and template on the state, UI-Router automatically creates the "views" property and pulls those properties to an "empty" view...</p> <pre><code>.state('base', { abstract: true, templateUrl: 'views/base.html', //Can't do this views: { // when this is there. "search": { templateUrl: "views/search.html" } } }) </code></pre> <p>Instead do: </p> <pre><code>.state('base', { abstract: true, views: { "": { templateUrl: 'views/base.html' }, "search": { templateUrl: "views/search.html" } } }) </code></pre> <h2>Second problem:</h2> <p>How views targeting works with nested views etc. is not very logical, it may work well if you restrict your self to one view in one view all the way down, but ones you start working with multiple named views it all gets confusing... Add unnamed views on top and many people gets lost...</p> <p>The way views work in UI-Router is the worst part of UI-Router...</p> <p>Given you example I am not even entirely sure of the way to target the search view from your abstract parent state... Might be:</p> <pre><code>.state('base', { abstract: true, views: { "": { templateUrl: 'views/base.html' }, "search@base": { templateUrl: "views/search.html" } } }) </code></pre> <p>If it can even be made to work... Alternatively you can move the search view out of base.html, but I guess you added it in there for a reason.</p> <p>The whole view concept is the biggest reason why I ended up writing <a href="https://github.com/dotJEM/angular-routing">https://github.com/dotJEM/angular-routing</a> instead.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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