{"id":228863,"date":"2014-07-06T20:11:02","date_gmt":"2014-07-06T16:11:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=228863"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=228863","title":{"rendered":"<span class=\"post_title\">\u0422\u043e\u043d\u043a\u043e\u0441\u0442\u0438 AngularJS: select \u0432\u043d\u0443\u0442\u0440\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 $transclude. <\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0442\u0430\u043a\u0430\u044f: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443, \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f select-\u0430. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0434\u043d\u0438\u043c \u0442\u0435\u0433\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0438 \u0441\u0435\u043b\u0435\u043a\u0442 \u0438 label \u043a \u043d\u0435\u043c\u0443 (\u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0443\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043d\u043e \u043c\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c). \u0412 \u043e\u0431\u0449\u0435\u043c \u0442\u043e, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 field. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0442\u0430\u043a: <\/p>\n<pre><code class=\"javascript\">&lt;field title=&quot;\u0426\u0432\u0435\u0442&quot; type=&quot;select&quot; ng-model=&quot;selectedColor&quot; options=&quot;color.id as color.name for color in colors&quot;&gt;&lt;\/field&gt; <\/code><\/pre>\n<p><a name=\"habracut\"><\/a><br \/>  \u041c\u044b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432:  <\/p>\n<ul>\n<li><b>title<\/b> \u2014 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f<\/li>\n<li><b>type<\/b> \u2014 \u0422\u0438\u043f \u043f\u043e\u043b\u044f (\u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e select, \u043d\u043e \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u0442\u043e\u043c&#8230;)<\/li>\n<li><b>ng-model<\/b> \u2014 \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/li>\n<li><b>options<\/b> \u2014 \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u0441\u0435\u043b\u0435\u043a\u0442\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u0430\u043d\u0433\u043b\u044f\u0440\u043e\u0432\u0441\u043a\u043e\u0433\u043e ngOptions<\/li>\n<\/ul>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <code>selectedColor<\/code> \u0438 <code>colors<\/code> \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 scope \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443. \u041c\u044b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0438\u0445 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u043a \u043d\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f. <\/p>\n<p>  \u041a\u043e\u0434 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b: <\/p>\n<pre><code class=\"javascript\">angular.module('directives').directive('field', function () { return { \t\/\/\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 - \u044d\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u0433\u0430 \trestrict: 'E',   \t\/\/ \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 \tscope: { \t\tngModel: &quot;=&quot;,  \t\ttitle: &quot;@&quot;, \t\ttype: &quot;@&quot;, \t\toptions: &quot;@&quot; \t},  \t\/\/ \u0430\u0434\u0440\u0435\u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0447\u0438\u043a\u0430 \ttemplateUrl: '\/tpl\/fields\/select.html', }); <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;field&quot;&gt; \t&lt;label&gt;{{title}}&lt;\/label&gt; \t&lt;select ng-model=&quot;ngModel&quot; ng-options=&quot;{{options}}&quot;&gt;&lt;\/select&gt; &lt;\/div&gt; <\/code><\/pre>\n<blockquote><p>\u0412\u0436\u0438\u0432\u0443\u044e: <a href=\"http:\/\/codepen.io\/Dzorogh\/pen\/umCKG?editors=101\">codepen.io\/Dzorogh\/pen\/umCKG?editors=101<\/a><\/p><\/blockquote>\n<p>  \u0412\u0440\u043e\u0434\u0435, \u0432\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 \u2014   <\/p>\n<pre><code class=\"html\">&lt;field title=&quot;\u0426\u0432\u0435\u0442&quot; type=&quot;select&quot; ng-model=&quot;selectedColor&quot; options=&quot;color.id as color.name for color in colors&quot;&gt; \t&lt;label&gt;\u0426\u0432\u0435\u0442&lt;\/label&gt; \t&lt;select ng:options=&quot;color.id as color.name for color in colors&quot; ng:model=&quot;ngModel&quot;&gt;&lt;\/select&gt; &lt;\/field&gt; <\/code><\/pre>\n<p>  \u0412\u0440\u043e\u0434\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u2026 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u0434\u0435 \u0432\u0441\u0435 options? \u041f\u043e\u0447\u0435\u043c\u0443 colors \u2014 \u043f\u0443\u0441\u0442 (\u0442\u043e\u0447\u043d\u0435\u0435, undefined)?<\/p>\n<p>  \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 scope, \u0442\u043e \u0432\u0441\u0435 \u0442\u0435\u043b\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0435\u043d\u043e\u0439 \u2014 isolate scope. \u042d\u0442\u043e \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b\u0439 \u0441\u043a\u043e\u0443\u043f \u043d\u0435 \u0434\u0430\u0435\u0442 \u0442\u0435\u043c, \u043a\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438, \u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 scope. \u041d\u043e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0441\u0435 \u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 (<code>ngModel, type, title, options<\/code>) \u0447\u0442\u043e \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b, \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043d\u0430\u0448 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b\u0439 scope \u0438 \u00ab\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b\u00bb \u043a \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c. <\/p>\n<p>  \u0418 \u0442\u0443\u0442 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u2014 \u043c\u044b \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <code>colors<\/code> \u043a \u0442\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c. \u0418 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e \u0442\u0430\u043c \u0437\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041c\u044b \u0443\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u0435\u0433\u043e \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 options.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0445\u043e\u0442\u044f \u0431\u044b \u0437\u043d\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u043f\u0430\u0440\u0441\u0438\u0442\u044c options. \u041d\u0430\u043c \u0442\u0443\u0442 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 angular.js, \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0430 \u0434\u043b\u044f ngOptions.<\/p>\n<p>  \u041d\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435, \u0434\u0430\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u0437 \u0432\u043d\u0435\u0448\u0435\u043d\u0433\u043e scope, \u043a\u0430\u043a \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u044c?<\/p>\n<h4>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435<br \/>  <\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0441 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0448\u0442\u0443\u043a\u0443, \u043a\u0430\u043a \u00abtransclude\u00bb. \u0412\u044b\u0437\u043e\u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443 \u0441\u043a\u043e\u0443\u043f\u0443 \u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u0442\u0442\u0443\u0434\u0430 \u0438 \u00ab\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c\u00bb \u0432 \u0441\u043a\u043e\u0443\u043f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b.<\/p>\n<p>  \u041d\u043e\u0432\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430, \u0441 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u043e\u0439 \u0438 \u0442\u0440\u0430\u043d\u0441\u043a\u043b\u044e\u0434\u043e\u043c:  <\/p>\n<pre><code class=\"javascript\">.directive('field', function() {    \/\/ \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043e \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 angularjs   var NG_OPTIONS_REGEXP = \/^\\s*(.*?)(?:\\s+as\\s+(.*?))?(?:\\s+group\\s+by\\s+(.*))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+(.*?)(?:\\s+track\\s+by\\s+(.*?))?$\/;   };    return {     restrict: 'E',     scope: {       ngModel: &quot;=&quot;,       type: &quot;@&quot;,       title: &quot;@&quot;,       options: &quot;@&quot;     },      \/\/ &quot;\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c&quot; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0441\u043a\u043b\u044e\u0434     transclude: true,     templateUrl: '\/fields\/select.html',      \/\/ $transclude \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0434\u0435\u0442 5\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c.     link: function (scope, element, attrs, controller, $transclude) {       if (scope.type == 'select') {         \/\/ \u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         var parsedOptions = attrs.options.match(NG_OPTIONS_REGEXP);          \/\/ \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u044b (\u043e\u043d\u0438 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 | )         var optionsArray = \/^(.*) \\|\/.exec(parsedOptions[7]) || parsedOptions[7];          \/\/ optionsArray - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 (\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435) \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.         \/\/ \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f, \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0435\u0433\u043e \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e Scope         \/\/ (\u0442\u043e\u0433\u043e, \u0433\u0434\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448.         $transclude(function (clone, $outerScope) {           scope[optionsArray] = $outerScope[optionsArray];         });       }     }    } }); <\/code><\/pre>\n<blockquote><p>\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 CodePen: <a href=\"http:\/\/codepen.io\/Dzorogh\/pen\/gBbyI\">codepen.io\/Dzorogh\/pen\/gBbyI<\/a><\/p><\/blockquote>\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\/228863\/\"> http:\/\/habrahabr.ru\/post\/228863\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 $transclude. <\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0442\u0430\u043a\u0430\u044f: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443, \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f select-\u0430. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0434\u043d\u0438\u043c \u0442\u0435\u0433\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0438 \u0441\u0435\u043b\u0435\u043a\u0442 \u0438 label \u043a \u043d\u0435\u043c\u0443 (\u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0443\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043d\u043e \u043c\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c). \u0412 \u043e\u0431\u0449\u0435\u043c \u0442\u043e, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 field. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0442\u0430\u043a: <\/p>\n<pre><code class=\"javascript\">&lt;field title=&quot;\u0426\u0432\u0435\u0442&quot; type=&quot;select&quot; ng-model=&quot;selectedColor&quot; options=&quot;color.id as color.name for color in colors&quot;&gt;&lt;\/field&gt; <\/code><\/pre>\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-228863","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/228863","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=228863"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/228863\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=228863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=228863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=228863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}