code: function linkForInput() {
                  var valTemplate = config.zValidateTemplate;
                  var requiredTemplate = config.zRequiredTemplate || '';
                  var decorator = angular.element('<span class="z-decorator"></span>');
                  if (attrs.zAppendTo){
                      angular.element(document.querySelector(attrs.zAppendTo)).append(decorator);
                  } else {
                      element.after(decorator);
                  }
  
                  // unwrap bound elements
                  decorator = decorator[0];
                  scope.$watch(info.getValErrs, valErrsChanged);
  
                  // update the message in the validation template
                  // when a validation error changes on an input control
                  // newValue is either a string or null (null when no bound entity)
                  function valErrsChanged(newValue) {
  
                      // HTML5 custom validity
                      // http://dev.w3.org/html5/spec-preview/constraints.html#the-constraint-validation-api
                      if (domEl.setCustomValidity) {
                          /* only works in HTML 5. Maybe should throw if not available. */
                          domEl.setCustomValidity(newValue || '');
                      }
  
                      var errorHtml = newValue ? valTemplate.replace(/%error%/, newValue) : "";
                      var isRequired = info.getIsRequired();
                      var requiredHtml = isRequired ? requiredTemplate : '';
                      decorator.innerHTML = (isRequired || !!errorHtml) ? requiredHtml + errorHtml : "";
                  }
              }
docs: directive is on an input element, so use templates for required and validation display