Please see this Plunker for an example:
http://plnkr.co/edit/pGWnxDToIDcI4BTDkH1l?p=preview
I inject '$cookiesProvider' into a .config() call and set a path:
$cookiesProvider.defaults = { path: '/invalid-path' };
But new cookies created with $cookies.put() do not use that path and are set/can be read.
Passing the same path into another $cookies.put() call correctly uses the path and the cookies is not created/can't be read.
You have to change the object in-place. Eg. $cookiesProvider.defaults.path = '/invalid-path';
Ah, great - I suspected I was doing something wrong but we couldn't figure it out in #angularjs yesterday. Thanks for the answer.
Most helpful comment
You have to change the object in-place. Eg.
$cookiesProvider.defaults.path = '/invalid-path';