Skip to content

Invalid Mapping error when using min.js version with paper-menu element. #56

@jd009

Description

@jd009

My code was as follows:

<paper-menu ng-model="mediaType" class="dropdown-content">  
     <paper-item>Video</paper-item>   
     <paper-item>Image</paper-item>   
</paper-menu>  

Using ng-polymer-elements.min.js, I would receive the following error:
Invalid mapping for "ngModel" - function name must be "property" or "event"

Using the ng-polymer-elements.js file (the full version), I do not see the error.

I dug into it and when Uglify passes over ng-polymer-elements.js, it converts this:

var multiSelectableMappings = {  
    ngModel: function property(element) {  
    return element.hasAttribute('multi') ? 'selectedValues' : 'selected';  
  }  
};  

into

multiSelectableMappings={ngModel:function(element){return element.hasAttribute("multi")?"selectedValues":"selected"}}  

This unfortunately deletes the function name "property" which makes the following code throw the exception:

case 'function':  
  switch(mapped.name) {  
  case 'property':  
    mappingType = '=';  
    break;  
  case 'event':  
    mappingType = '&';  
    break;  
  default:  
    throw 'Invalid mapping for "' + attr  
      + '" - function name must be "property" or "event"';  
  }  

The mapped.name does not find the name 'property' in the function because Uglify removed it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions