An angular module to report on bootstrap's reponsive grid breakpoints. The injected html snipped uses bootstrap's named breakpoints so your script doesn't need to know anything about the actual css dimensions.
- Include
ScreenSize
as a dependency of your app - Reference
ScreenSizeFactory
in your controler's DI list
angular
.module('yourMod', ['ScreenSize'])
.controller('yourModCtrl, function(ScreenSizeFactory){
...
}
var screenSize = ScreenSizeFactory.name(); // returns 'xs', 'sm', 'md', or 'lg'
if( ScreenSizeFactory.if('md') ){
//do something only at the 'md' screen size
}
## Gotchya
This may cause tests to fail for controllers that depend on `ScreenSizeFactory` when use a headless environment like PhantomJS.
> 2015 @alanguir