Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jd009 opened this issue Jan 22, 2016 · 1 comment
Open

Comments

@jd009
Copy link

jd009 commented Jan 22, 2016

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.

@jd009
Copy link
Author

jd009 commented Jan 22, 2016

I made a Pull Request to fix this issue.

@GabiAxel GabiAxel reopened this Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants