Importing CSS Breakpoints Into Javascript

A quick and easy solution to this problem is to have your JS import the breakpoints directly from the CSS values in the DOM. This solution brings the current breakpoint variable into your JS in a way that’s:

  • Simple & Lightweight
  • DRY
  • Compatible with all browsers that support media queries (IE9+)


See Lullabot article, Importing CSS Breakpoints Into Javascript

Facebooktwittergoogle_plusredditpinterestlinkedinmail

4 Keys to a Clean Angular Implementation

tldr

  1. Modify all model properties in the controller rather than the view; let the view have access to the capability via controller functions.
  2. Keep all magic values (if you must have them at all) in the controller accessing them in the view via controller functions.
  3. Evaluate all comparison, computation, and logical expressions in the controller, giving the view access to them via controller functions.
  4. Pass to a controller function only what it does not already know: the loop parameter if in a loop, or no parameters at all if outside of a loop.

4 Keys to a Clean Angular Implementation

Facebooktwittergoogle_plusredditpinterestlinkedinmail