{"id":190096,"date":"2013-08-14T23:40:02","date_gmt":"2013-08-14T19:40:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=190096"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=190096","title":{"rendered":"<span class=\"post_title\">\u041c\u043e\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f nested routing \u0432 AngularJS<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 <a href=\"http:\/\/angularjs.org\/\">AngularJS<\/a>, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0438\u0436\u043d\u0438\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u043a \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 <code>$route<\/code> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0438\u0434, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u0435\u0433\u043e scope \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f URL \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. <\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/angular-ui\/ui-router\">ui-router<\/a>. \u041f\u043e \u0440\u044f\u0434\u0443 \u043f\u0440\u0438\u0447\u0438\u043d \u043d\u0438 \u043e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u043b\u043e, \u0438 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e: <a href=\"https:\/\/github.com\/artch\/angular-route-segment\">angular-route-segment<\/a>.<\/p>\n<p>  \u0427\u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c?<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/artch.ru\/angular-route-segment\/example\/\">artch.ru\/angular-route-segment\/example\/<\/a><br \/>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <a href=\"https:\/\/github.com\/artch\/angular-route-segment\/tree\/master\/example\">example<\/a> \u043d\u0430 \u0413\u0438\u0442\u0445\u0430\u0431\u0435.<\/p>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u043b\u0443\u0436\u0438\u0442 \u0437\u0430\u043c\u0435\u043d\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0443 <code>$route<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 <b>\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/b>, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0447\u043a\u0443, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. <\/p>\n<pre><code class=\"javascript\">angular.module('app').config(function ($routeSegmentProvider) {  $routeSegmentProvider.      when('\/section1',          's1.home').     when('\/section1\/prefs',    's1.prefs').     when('\/section1\/:id',      's1.itemInfo.overview').     when('\/section1\/:id\/edit', 's1.itemInfo.edit').     when('\/section2',          's2').      segment('s1', {         templateUrl: 'templates\/section1.html',         controller: MainCtrl}).      within().          segment('home', {             templateUrl: 'templates\/section1\/home.html'}).          segment('itemInfo', {             templateUrl: 'templates\/section1\/item.html',             controller: Section1ItemCtrl,             dependencies: ['id']}).          within().              segment('overview', {                 templateUrl: 'templates\/section1\/item\/overview.html'}).              segment('edit', {                  templateUrl: 'templates\/section1\/item\/edit.html'}).              up().          segment('prefs', {             templateUrl: 'templates\/section1\/prefs.html'}).          up().      segment('s2', {         templateUrl: 'templates\/section2.html',         controller: MainCtrl}); <\/code><\/pre>\n<p>  \u0414\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u043d\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0431\u0435\u0437 \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443:<\/p>\n<pre><code class=\"javascript\">$routeSegmentProvider.segment('s1', {     templateUrl: 'templates\/section1.html',     controller: MainCtrl});  $routeSegmentProvider.within('s1').segment('home', {     templateUrl: 'templates\/section1\/home.html'});  $routeSegmentProvider.within('s1').segment('itemInfo', {     templateUrl: 'templates\/section1\/item.html',     controller: Section1ItemCtrl,     dependencies: ['id']}); <\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>app-view-segment<\/code> (\u0437\u0430\u043c\u0435\u043d\u0430 \u0448\u0442\u0430\u0442\u043d\u043e\u043c\u0443 <code>ng-view<\/code>) \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u043e \u0432 DOM \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u0443\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d:<\/p>\n<p>  <b>index.html<\/b>  <\/p>\n<pre><code class=\"html\">&lt;ul&gt;     &lt;li&gt;&lt;a href=&quot;\/section1&quot;&gt;Section 1&lt;\/a&gt;&lt;\/li&gt;     &lt;li&gt;&lt;a href=&quot;\/section2&quot;&gt;Section 2&lt;\/a&gt;&lt;\/li&gt; &lt;\/ul&gt; &lt;div id=&quot;contents&quot; app-view-segment=&quot;0&quot;&gt;&lt;\/div&gt; <\/code><\/pre>\n<p>  <b>section1.html<\/b> (\u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <code>div#contents<\/code>)  <\/p>\n<pre><code class=\"html\">&lt;h4&gt;Section 1&lt;\/h4&gt; Section 1 contents. &lt;div app-view-segment=&quot;1&quot;&gt;&lt;\/div&gt; <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u0442 <code>&lt;div&gt;<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0432 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438 \u043f\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u0441 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/190096\/\"> http:\/\/habrahabr.ru\/post\/190096\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 <a href=\"http:\/\/angularjs.org\/\">AngularJS<\/a>, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0438\u0436\u043d\u0438\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u043a \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 <code>$route<\/code> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0438\u0434, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u0435\u0433\u043e scope \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f URL \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. <\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/angular-ui\/ui-router\">ui-router<\/a>. \u041f\u043e \u0440\u044f\u0434\u0443 \u043f\u0440\u0438\u0447\u0438\u043d \u043d\u0438 \u043e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u043b\u043e, \u0438 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e: <a href=\"https:\/\/github.com\/artch\/angular-route-segment\">angular-route-segment<\/a>.<\/p>\n<p>  \u0427\u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c?  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-190096","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/190096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=190096"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/190096\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=190096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=190096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=190096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}