• <bdo id='1U0CB'></bdo><ul id='1U0CB'></ul>
    <tfoot id='1U0CB'></tfoot>

    <small id='1U0CB'></small><noframes id='1U0CB'>

    <legend id='1U0CB'><style id='1U0CB'><dir id='1U0CB'><q id='1U0CB'></q></dir></style></legend>

      1. <i id='1U0CB'><tr id='1U0CB'><dt id='1U0CB'><q id='1U0CB'><span id='1U0CB'><b id='1U0CB'><form id='1U0CB'><ins id='1U0CB'></ins><ul id='1U0CB'></ul><sub id='1U0CB'></sub></form><legend id='1U0CB'></legend><bdo id='1U0CB'><pre id='1U0CB'><center id='1U0CB'></center></pre></bdo></b><th id='1U0CB'></th></span></q></dt></tr></i><div id='1U0CB'><tfoot id='1U0CB'></tfoot><dl id='1U0CB'><fieldset id='1U0CB'></fieldset></dl></div>

        简单的 ui-routes,请解释一下

        simple ui-routes, explanation please(简单的 ui-routes,请解释一下)
        <tfoot id='HZfAv'></tfoot>
        <legend id='HZfAv'><style id='HZfAv'><dir id='HZfAv'><q id='HZfAv'></q></dir></style></legend>

            <tbody id='HZfAv'></tbody>
            • <bdo id='HZfAv'></bdo><ul id='HZfAv'></ul>
              • <small id='HZfAv'></small><noframes id='HZfAv'>

                <i id='HZfAv'><tr id='HZfAv'><dt id='HZfAv'><q id='HZfAv'><span id='HZfAv'><b id='HZfAv'><form id='HZfAv'><ins id='HZfAv'></ins><ul id='HZfAv'></ul><sub id='HZfAv'></sub></form><legend id='HZfAv'></legend><bdo id='HZfAv'><pre id='HZfAv'><center id='HZfAv'></center></pre></bdo></b><th id='HZfAv'></th></span></q></dt></tr></i><div id='HZfAv'><tfoot id='HZfAv'></tfoot><dl id='HZfAv'><fieldset id='HZfAv'></fieldset></dl></div>

                  本文介绍了简单的 ui-routes,请解释一下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I came to know that ui-roues are much powerful and advantageous than ngRoutes, recently. So I satrted studiing the ui-routing feature from http://www.ng-newsletter.com/posts/angular-ui-router.html . BUt could not undersatnd withh the examples they have given especially from "Multiple named views" in http://jsfiddle.net/jwebe0pe/9vH9Z/, as they have given the explanation using d3.js, which I do not know.

                  1. I request here you guys, to give me a simple jsfiddle explantion, about how to implement Multiple view ui-route

                  2. What is the importance of

                  $stateProvider.state('admin', {
                          abstract: true,
                          url: '/admin',
                          template: '<div ui-view></div>'
                        }).state('admin.index', {
                          url: '/index',
                          template: 'Admin index'
                        }).state('admin.users', {
                          url: '/users',
                          template: '<ul>...</ul>'
                        });
                  

                  admin, admin.index and admin.users, in the code above and when will be used.

                  3 Could not able to understand the abstract: true/false concept.

                  Please clarify me in the above points.

                  Hope you guys help me.

                  解决方案

                  The best you could do is to go through all the links mentioned in this Q&A:

                  • example app by ui-router team
                  • source code of that example
                  • and essential state.js definition, one of the best documented codes ever
                  • plus the wiki

                  Here I created another example with some master layout introducing TOP, LEFT, MAIN areas as separted multi-views.

                  That Layout state would be defined as this:

                  .state('index', {
                      url: '/',
                      views: {
                        '@' : {
                          templateUrl: 'layout.html',
                          controller: 'IndexCtrl'
                        },
                        'top@index' : { templateUrl: 'tpl.top.html',},
                        'left@index' : { templateUrl: 'tpl.left.html',},
                        'main@index' : { templateUrl: 'tpl.main.html',},
                      },
                    })
                  

                  the core template injected into index.html element <div ui-view></div>:

                  <div>
                    <section class="top">
                      <div ui-view="top"></div> // TOP here
                    </section>
                    
                    <section class="middle">
                      
                      <section class="left">
                        <div ui-view="left"></div> // LEFT here
                      </section>
                      
                      <section class="main">
                        <div ui-view="main"></div> // MAIN here
                      </section>
                    
                    </section>
                  </div>
                  

                  So we can see, that one state ('index' above) has one master view (layout) and also other views, injected into that layout template, using the absolute view naming:

                  • View Names - Relative vs. Absolute Names (cite:)

                  Behind the scenes, every view gets assigned an absolute name that follows a scheme of viewname@statename, where viewname is the name used in the view directive and state name is the state's absolute name, e.g. contact.item. You can also choose to write your view names in the absolute syntax.

                  I.e. the part of state definition: 'top@index' : { templateUrl: 'tpl.top.html',}, says:

                  • inject tpl.top.html template into the view named top
                  • search for that name inside of a state named index
                  • these information together: top + index == 'top@index' view name

                  Observe the plunker - to see that in action...in very simplified example....

                  EXTEND: to give some more explanation to the extended question

                  What is abstract state? I.e state marked as abstract: true...

                  Like in any other languague (C#, Java) it is a standard state, which cannot be instantiated, reached directly. It is always a parent state, intended to handle some basic functionality. Namely:

                  • views do profit from Scope Inheritance by View Hierarchy Only:

                  Keep in mind that scope properties only inherit down the state chain if the views of your states are nested. Inheritance of scope properties has nothing to do with the nesting of your states and everything to do with the nesting of your views (templates).

                  It is entirely possible that you have nested states whose templates populate ui-views at various non-nested locations within your site. In this scenario you cannot expect to access the scope variables of parent state views within the views of children states.

                  so, the parent controller can be provided with some resolver settings, it can handle authorization, it can load data... Simply, as a parent, it can do lot of common stuff for children, while it cannot be reached directly

                  • it also can make templating easier. because it the abstract parent would containt e.g. template.layout... children can use realtive view naming.

                  So, abstract is a feature. Feature very similar to standard inehritance...

                  这篇关于简单的 ui-routes,请解释一下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                    <bdo id='Sr9WY'></bdo><ul id='Sr9WY'></ul>
                    <tfoot id='Sr9WY'></tfoot>

                      1. <i id='Sr9WY'><tr id='Sr9WY'><dt id='Sr9WY'><q id='Sr9WY'><span id='Sr9WY'><b id='Sr9WY'><form id='Sr9WY'><ins id='Sr9WY'></ins><ul id='Sr9WY'></ul><sub id='Sr9WY'></sub></form><legend id='Sr9WY'></legend><bdo id='Sr9WY'><pre id='Sr9WY'><center id='Sr9WY'></center></pre></bdo></b><th id='Sr9WY'></th></span></q></dt></tr></i><div id='Sr9WY'><tfoot id='Sr9WY'></tfoot><dl id='Sr9WY'><fieldset id='Sr9WY'></fieldset></dl></div>
                      2. <legend id='Sr9WY'><style id='Sr9WY'><dir id='Sr9WY'><q id='Sr9WY'></q></dir></style></legend>

                          <tbody id='Sr9WY'></tbody>

                        1. <small id='Sr9WY'></small><noframes id='Sr9WY'>