{"id":218385,"date":"2014-04-06T16:20:02","date_gmt":"2014-04-06T12:20:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=218385"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=218385","title":{"rendered":"<span class=\"post_title\">\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043d\u043e \u043c\u0430\u043b\u043e \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c.<\/p>\n<p>  \u0425\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u0430  <\/p>\n<ul>\n<li>\u0440\u0435\u0448\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443<\/li>\n<li>\u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u0441\u044f<\/li>\n<li>\u043d\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430\u043c\u0438<\/li>\n<\/ul>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f (\u0434\u0443\u043c\u0430\u044e, \u0432\u0441\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u043e \u043f\u043e\u043b\u0435 \u0441 \u0433\u043b\u0430\u0437\u0438\u043a\u043e\u043c)<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/cb3\/bbc\/973\/cb3bbc97320554d91ff2e13f31c8ee66.png\" alt=\"image\"\/><\/p>\n<pre><code class=\"html\">&lt;input ng-model=&quot;user.password&quot;        ng-minlength=&quot;6&quot;        form-password        form-error=&quot;\u041d\u0435 \u043c\u0435\u043d\u0435\u0435 6 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432&quot;&gt; <\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f?<a name=\"habracut\"><\/a><br \/>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0438\u0445 7<\/p>\n<ol>\n<li><code>ng-model<\/code><\/li>\n<li><code>ng-minlength<\/code><\/li>\n<li><code>form-password<\/code> \u2014 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0438\u043d\u043f\u0443\u0442 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043f\u043e\u043b\u044f (password\/text) \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u0433\u043b\u0430\u0437\u0438\u043a<\/li>\n<li><code>form-error<\/code> \u2014 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0443\u043b\u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 \u0435\u0441\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u0438\u043d\u043d\u044b\u0439<\/li>\n<li><code>form-error-tooltip<\/code> \u2014 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0443\u043b\u0442\u0438\u043f \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u043d\u0430\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c<\/li>\n<li><code>form-error-tooltip-template<\/code> \u2014 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0442\u0443\u043b\u0442\u0438\u043f\u0430<\/li>\n<li><code>tooltip<\/code> \u2014 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Angular Bootstrap, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043c<\/li>\n<\/ol>\n<h4>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c tooltip \u0438\u0437 <a href=\"http:\/\/angular-ui.github.io\/bootstrap\/#\/tooltip\">angular-ui.github.io\/bootstrap\/#\/tooltip<\/a> \u0438 <a href=\"https:\/\/github.com\/angular-ui\/bootstrap\/blob\/master\/src\/tooltip\/tooltip.js\">\u0435\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a><\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430, \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b, \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0439 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 <code>$tooltip<\/code>. \u0418\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">.directive( 'tooltip', [ '$tooltip', function ( $tooltip ) {   return $tooltip( 'tooltip', 'tooltip', 'mouseenter' ); }]) <\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0435 \u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0442\u0443\u043b\u0442\u0438\u043f\u0430. \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>directiveName +'-popup '<\/code> (directiveName = tooltip \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435):<\/p>\n<pre><code class=\"javascript\">'&lt;div '+ directiveName +'-popup '+           'title=&quot;'+startSym+'tt_title'+endSym+'&quot; '+           'content=&quot;'+startSym+'tt_content'+endSym+'&quot; '+           'placement=&quot;'+startSym+'tt_placement'+endSym+'&quot; '+           'animation=&quot;tt_animation&quot; '+           'is-open=&quot;tt_isOpen&quot;'+           '&gt;'+  '&lt;\/div&gt;'; <\/code><\/pre>\n<p>  \u041d\u0430\u0439\u0434\u0435\u043c \u043d\u0438\u0436\u0435 \u044d\u0442\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 (\u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439):<\/p>\n<pre><code class=\"javascript\">.directive( 'tooltipPopup', function () {   return {     restrict: 'EA',     replace: true,     scope: { content: '@', placement: '@', animation: '&', isOpen: '&' },     templateUrl: 'template\/tooltip\/tooltip-popup.html'   }; }) <\/code><\/pre>\n<p>  \u041f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 template\/tooltip\/tooltip-popup.html \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043d\u0430\u0439\u0434\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0442\u0443\u043b\u0442\u0438\u043f\u0430.<\/p>\n<p>  \u041a\u0430\u043a \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430, \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0441\u044f, \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u0442\u043e\u0432\u0430\u0441\u0438\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 \u0442\u0443\u043b\u0442\u0438\u043f\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043e\u043a \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c. \u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u0441\u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>open <\/code>\u0438 \u0438\u0441\u0447\u0435\u0437\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u2014 <code>close<\/code><\/p>\n<pre><code class=\"javascript\">app.directive('formErrorTooltip', function($tooltip) {     return $tooltip('formErrorTooltip', 'formErrorTooltip', 'open'); }); <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430. \u041a\u0440\u0443\u0442\u043e?<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c form-error-tooltip-popup (\u043f\u043e\u043c\u043d\u0438\u0442\u0435 directiveName +&#8217;-popup &#8216;). \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0432 tooltip-popup, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0438\u043c\u044f \u0438 \u043f\u0443\u0442\u044c \u0434\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430.<\/p>\n<p>  \u0421\u043e\u0431\u044b\u0442\u0438\u044f <code>open<\/code> \u0438 <code>close<\/code> \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0431\u0435\u0434\u0430. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.  <\/p>\n<pre><code class=\"javascript\">app.config(function($tooltipProvider) {     $tooltipProvider.setTriggers({'open': 'close'}); }); <\/code><\/pre>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c <code>form-error-tooltip<\/code>, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0442\u0443\u043b\u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0438, \u0435\u0441\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u043c\u0430\u043b\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (\u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435). \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 <code>form-error<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442 \u043f\u0435\u0440\u0432\u0443\u044e:<\/p>\n<pre><code class=\"javascript\">app.directive('formError', function($compile, $interpolate, $injector) {     return {         terminal: true,         priority: 100,         scope: true,         compile: function compile(tElement, tAttrs) {             var startSym = $interpolate.startSymbol(),                 endSym = $interpolate.endSymbol(),                 ddo = {}, self = this;              tElement.attr('form-error-tooltip', startSym + 'message' + endSym);              angular.forEach(tAttrs.$attr, function(value, attr) {                 if ($injector.has(attr + 'Directive')) {                     ddo = $injector.get(attr + 'Directive')[0];                 }                 if (ddo.terminal && ddo.priority &gt;= self.priority) {                     tElement.removeAttr(value);                 }             });              return function(scope, element, attrs, controller) {                 $compile(element)(scope);                                  var ngModelCtrl = element.controller('ngModel')                  element.on('input blur change', checkValidity);                  function checkValidity() {                     if (ngModelCtrl.$error.minlength) {                         setError(attrs.formError);                      } else if (element.scope() && element.scope().tt_isOpen) { \/\/avoid tooltip bug                         element.triggerHandler('close');                     }                 }                  function setError(message) {                     scope.message = message;                     scope.$digest(); \/\/set message to tooltip                     element.triggerHandler('open');                 }             };         }     }; }); <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043a\u043e\u0434\u0430, \u043e\u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 <code>form-error-tooltip<\/code> \u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0438\u0442 \u043d\u0430 \u043d\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f <code>open<\/code> \u0438 <code>close<\/code> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u043e \u043a\u0430\u043a \u043e\u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442? \u0412\u0441\u0435 \u0434\u0435\u043b\u043e \u0432 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u0445.<\/p>\n<p>  \u0418\u0437-\u0437\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 <code>terminal: true, priority: 100<\/code> \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0438\u043b\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0434\u043e \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <code>ng-if, ng-repeat, ng-include<\/code> \u0438 \u0442.\u043f., \u0442.\u0435. \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435, \u043d\u0443\u0436\u043d\u043e \u043b\u0438, \u0432\u043e\u043e\u0431\u0449\u0435, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>form-error-tooltip={{message}}<\/code>, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438\u0441\u044c), \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441\u0430\u043c\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430 \u0441\u0435\u0431\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438 \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u043f\u043e\u043a\u0430\u0437\u0430 \u0442\u0443\u043b\u0442\u0438\u043f\u0430, \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432.<\/p>\n<h4>\u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043c \u0441 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u043f\u0430\u0440\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<pre><code class=\"javascript\">app.directive('formPassword', function($compile, $injector) {     return {         restrict: 'AE',         terminal: true,         priority: 200,         templateUrl: 'passwordTemplate.html',         replace: true,         scope: true,         compile: function(tElement, tAttrs) {             var input = tElement.find('input')[0], ddo = {}, self = this;              angular.forEach(tAttrs.$attr, function(value, attr) {                 if ($injector.has(attr + 'Directive')) {                     ddo = $injector.get(attr + 'Directive')[0];                 }                 if (attr !== 'type' && attr !== 'class' && attr !== 'formPassword' && (!ddo.terminal || ddo.priority &lt; self.priority)) {                     input.setAttribute(value, tAttrs[attr]);                 }                 if (attr !== 'class') {                     tElement.removeAttr(value);                 }             });              return function(scope) {                 scope.show = false;             }         }     }; }); <\/code><\/pre>\n<p>  <i>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>tranclude<\/code>, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043b\u0438\u0431\u043e \u0442\u0430\u043a\u043e\u0439 \u043e\u0433\u043e\u0440\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0443\u0436 \u0442\u0430\u043a.<\/i><\/p>\n<p>  \u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0443 \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0443 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043f\u043e\u043b\u0435 \u0441 \u0433\u043b\u0430\u0437\u0438\u043a\u043e\u043c \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043a \u043d\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u0443 <code>ng-if<\/code> \u0438\u043b\u0438 <code>ng-repeat<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0441\u044f \u044d\u0442\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0440\u044b\u0442\u0430, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u043d\u043e\u0436\u0435\u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0440\u0430\u0437 \u0438 \u0432\u0441\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u0440\u0443\u0436\u0438\u0442\u044c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<p>  \u0416\u0438\u0432\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: <a href=\"http:\/\/plnkr.co\/edit\/BSVN7zZb0vNEAXo7iWhM?p=preview\">plnkr.co\/edit\/BSVN7zZb0vNEAXo7iWhM?p=preview<\/a>    \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\/218385\/\"> http:\/\/habrahabr.ru\/post\/218385\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043d\u043e \u043c\u0430\u043b\u043e \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c.<\/p>\n<p>  \u0425\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u0430  <\/p>\n<ul>\n<li>\u0440\u0435\u0448\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443<\/li>\n<li>\u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u0441\u044f<\/li>\n<li>\u043d\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430\u043c\u0438<\/li>\n<\/ul>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f (\u0434\u0443\u043c\u0430\u044e, \u0432\u0441\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u043e \u043f\u043e\u043b\u0435 \u0441 \u0433\u043b\u0430\u0437\u0438\u043a\u043e\u043c)<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/cb3\/bbc\/973\/cb3bbc97320554d91ff2e13f31c8ee66.png\" alt=\"image\"\/><\/p>\n<pre><code class=\"html\">&lt;input ng-model=&quot;user.password&quot;        ng-minlength=&quot;6&quot;        form-password        form-error=&quot;\u041d\u0435 \u043c\u0435\u043d\u0435\u0435 6 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432&quot;&gt; <\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f?<\/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-218385","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/218385","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=218385"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/218385\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=218385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=218385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=218385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}