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

INT value options break the module #22

Open
kbaggott opened this issue Jun 11, 2015 · 0 comments
Open

INT value options break the module #22

kbaggott opened this issue Jun 11, 2015 · 0 comments

Comments

@kbaggott
Copy link

In trying to add gutter into the options for the masonry today, I noticed that when setting "gutter" the whole module broke. This appears to be because of the way Masonry looks at strings rather than Ints, in your code you get the options via .fromJson which always returns a string.
I have put in a quick fix to my code, may be a better way but it works for me. If this is helpful to you then please run with it, great module btw.


//line 7...
      var container = elem[0];
      var options = angular.extend({
           itemSelector: '.item'
      }, angular.fromJson(attrs.masonry));

      // NEW - check for int value options
      angular.forEach(options, function(x, y){
            if (!isNaN(x)) options[y] = parseInt(x);
      });

     var masonry = scope.masonry = new Masonry(container, options);
//line 19...

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

1 participant