src/sixth.js
/**
     * @ngdoc Controller
     * @name Controller:bindElements
     *
     * @description
     *  Sort each element with data-model attribut to it model in scope
     */
@ngdoc Controller
@name Controller:bindElements

@description
Sort each element with data-model attribut to it model in scope
@ngdoc Controller @name Controller : bindElements @description Sort each element with data - model attribut to it model in scope
bindElements(elements, item, alias) {
      let init = (element, property, type, item) => {
        let value = item || this.scope.getFromPath(property);
        if (!EXCLUDED_TYPES[type] && utils.isUndefined(value)) return false;
        Binding_Types[type].init.call(this, element, property, value, alias);
        !EXCLUDED_TYPES[type] && Binding_Types[type].render.call(this, element, value);
        return true;
      };
      let matchText = (elem, type, text, item, alias, name) => {
        let match = INTERPOLATE.exec(text)
          , prop
          , obj;
        if (!match) return;
        prop = match[1].replace(SPACE_REG, '');
        obj = {
          name: name,
          elem: elem,
          fn: tmplEngine.compile(text, prop.includes(alias) ? alias : undefined)
        };
        while (match = INTERPOLATE.exec(text)) {
          if(!init(obj, match[1].replace(SPACE_REG, ''), type, item)) return;
        }
      };
      utils.forEachNode(elements, (element) => {
        let attr = element.getAttribute(BIND_ATTR)
          , data;
        if (element.hasAttributes()) {
          utils.forEachNode(element.attributes, (attr) => {
            matchText(element, 'attr', attr.value, item, alias, attr.name);
          });
        }
        utils.forEachNode(element.childNodes, (child) => {
          if (child.nodeType !== TEXT_NODE) return;
          matchText(child, 'text', child.textContent, item, alias)
        });
        if (!attr) return;
        data = utils.parseAttrData(attr);
        element.$bindingTypes = data;
        Object.keys(data).forEach((type) => {
          if (!Binding_Types.hasOwnProperty(type)) {
            return new logError('Invalid binding type in: ' + type)
          }
          init(element, data[type], type, item)
        });
      });
    }
bindElements ( elements , item , alias ) { let init = ( element , property , type , item ) => { let value = item || this . scope . getFromPath ( property ) ; if ( ! EXCLUDED_TYPES [ type ] && utils . isUndefined ( value ) ) return false ; Binding_Types [ type ] . init . call ( this , element , property , value , alias ) ; ! EXCLUDED_TYPES [ type ] && Binding_Types [ type ] . render . call ( this , element , value ) ; return true ; } ; let matchText = ( elem , type , text , item , alias , name ) => { let match = INTERPOLATE . exec ( text ) , prop , obj ; if ( ! match ) return ; prop = match [ 1 ] . replace ( SPACE_REG , '' ) ; obj = { name : name , elem : elem , fn : tmplEngine . compile ( text , prop . includes ( alias ) ? alias : undefined ) } ; while ( match = INTERPOLATE . exec ( text ) ) { if ( ! init ( obj , match [ 1 ] . replace ( SPACE_REG , '' ) , type , item ) ) return ; } } ; utils . forEachNode ( elements , ( element ) => { let attr = element . getAttribute ( BIND_ATTR ) , data ; if ( element . hasAttributes ( ) ) { utils . forEachNode ( element . attributes , ( attr ) => { matchText ( element , 'attr' , attr . value , item , alias , attr . name ) ; } ) ; } utils . forEachNode ( element . childNodes , ( child ) => { if ( child . nodeType !== TEXT_NODE ) return ; matchText ( child , 'text' , child . textContent , item , alias ) } ) ; if ( ! attr ) return ; data = utils . parseAttrData ( attr ) ; element . $bindingTypes = data ; Object . keys ( data ) . forEach ( ( type ) => { if ( ! Binding_Types . hasOwnProperty ( type ) ) { return new logError ( 'Invalid binding type in: ' + type ) } init ( element , data [ type ] , type , item ) } ) ; } ) ; }
@ngdoc Controller
 @name Controller:bindElements
@ngdoc Controller @name Controller : bindElements