Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ module.directive ('facebook', function ($location, facebook) {
* during login default is basic_info.
*
* @example
* <facebook-login size="large" auto-logout="false"></facebook-logout>
* <facebook-login size="large" auto-logout="false"></facebook-login>
*/
module.directive ('facebookLogin', function () {
var template =
Expand Down Expand Up @@ -210,7 +210,7 @@ module.directive ('facebookLogin', function () {
* @restrict E
*
* @description
* Shows facebook like/share/recommend button.
* Shows facebook like/share/recommend button, documentation here : https://developers.facebook.com/docs/plugins/like-button
*
* @param {string} href indicates the page that will be liked. if not provided current
* absolute URL will be used.
Expand All @@ -229,11 +229,11 @@ module.directive ('facebookLogin', function () {
module.directive('facebookLike', function ($location) {
var template = '<div class="fb-like" ' +
'data-href="{{href || currentPage}}" ' +
'data-width="{{width || 250}}"' +

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

250px is only applicable for "standard" layout, by setting width default value to this in other layouts it might cause problems. I suggest adding width to template only when it's provided.
Like:

if (width) {
    // inject data-width="{{width}}" to template
}

'data-colorscheme="{{colorScheme || \'light\'}}" ' +
'data-layout="{{layout || \'standard\'}}" ' +
'data-action="{{ action || \'like\'}}" ' +
'data-show-faces="{{!!showFaces}}" ' +
'data-share="{{!!share}}"' +
'data-share="{{share || \'true\'}}"' +

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess !!share and share || 'true' should have same effect, isn't it? While I think !!share is more readable. Did I miss anything here?
As a reminder parameter must be provided as false not 'false' as string since string will be considered as true always.

 <facebook-like share=false /> 

should do the job.

'data-action="{{action || \'like\'}}"' +
'data-send="false"></div>';

Expand All @@ -244,6 +244,7 @@ module.directive('facebookLike', function ($location) {
'layout': '@',
'showFaces': '@',
'href': '@',
'width': '@',
'action': '@',
'share': '@',
},
Expand Down