sirkitree / angular-directive.g-signin

:triangular_ruler: AngularJS Directive for Google Plus Sign-in Button
http://jeradbitner.com/angular-directive.g-signin/
148 stars 84 forks source link

Properly overwrite default values if explicitly provided. #30

Closed phw closed 9 years ago

phw commented 9 years ago

This patch will probably overwrite the default values with explicitly provided valuies. Without this patch overwriting any value, as e.g. width in the example below, won't work:

<google-plus-signin
    clientid="myclientid"
    language="en"
    width="iconOnly"></<google-plus-signin>

The existing code does update the attributes with the default values, but the attributes are actually never used since the defaults are passed directly to gapi.signin.render. This patch reverses this and now the defaults get overwritten with explicitly provided attributes.

sirkitree commented 9 years ago

Excellent, thank you very much!

phw commented 9 years ago

I just noticed a different but related issue: You cannot use any attribute that is not defined in the defaults, e.g. height.

I see three ways this could be solved:

  1. Extend the defaults list to include all the attributes. This would require adding all the attributes defined in https://developers.google.com/+/web/signin/reference#sign-in_button_attributes and probably duplicating the standard Google defaults.
    1. Provide a separate array of possible attributes. Instead of iterating over the defaults we would iterate over this array and set the option either from what the user provided, from the defaults or not at all (thus using Google's default)
    2. Just allow everything

I tend toward 2. Any thoughts?

sirkitree commented 9 years ago

I think we should just allow everything.