Posts

Showing posts from January, 2014

angular js - ngCookie

Warning: if you need to set cookie expiration, httpSecure, path or subdomain then ngCookies doesn't support as of v1.2.7. I plan to use jquery-cookie.js which angular issues also reference, and there is a number of issues open related to this gap in $cookies. Angular js provides support for cookie manipulation in the core library file angular-cookies.js (v1.2.7). That file defines a module ngCookies with 2 factory services: - $cookies - $cookieStore For setting of a simple property on a cookie then $cookies is the factory to use. For setting js objects (key-value pairs) in the cookie then $cookieStore is what to use. To use:  1. include the angular-cookies.js file in yout html 2. include the module ngCookies as a module dependency where you wish to use 3. request $cookies or $cookieStore (or both) to be injected by the dependency injector Using $cookie.  With $cookie you can treat a cookie name as a property on $cookie.   var cookieValue = $cookies.cookieName;  

angular js protractor e2e cheatsheet

Many from the protractor test suite category detailed task syntax example load page load a page browser.get('yoururl') browser btn actions browser back/forward browser.navigate().back() OR browser.navigate().forward() access elements on page See Protractor API list and examples from Protractors test suite access by angular ngmodel name (must match ngmodel in the html) this is the preferred approach element(by.model('person.name')); access by the css id on the page e.g, #user_name (but this can be brittle) element(by.id('user_name')) access angular binding to get generated value i.e. for {{}} element(by.binding('person.concatName')); access angular repeat list data (must match repeat stmt in the html) See Protractor test suit l

css rule limits in IE9 and below

Believe it or not, but IE9 and below has a limit on the number of css selectors which can be in any one stylesheet Here's how we discovered it: we'd build a minified build of css into one file for staging and production. Load the app in Chrome and IE10, all is ok. Load in IE9 and its like some styles are just not there. Looking in IE9s css debugger I could see many of our custom styles were missing (IEs debugger aint Chrome debugger but its not bad either) I had to wrap up some work in progress (angular.js core library upgrade) but started to troubleshoot after that. Normally one would suspect some IE quirky rule which busts the css but with such a large failure I surmised there must be a large reason, not a simple rule failure. So, no "pussy-footing" around with this problem. I recreated the stage build locally (we have a good deploy grunt script) and just started hacking at the one large css file cutting out large chunks and reloading the css. When load the