angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

More powerful $cookies service

Open reichart opened this issue 14 years ago • 67 comments

I want to set a cookie on the root path / so it's available everywhere on the domain.

But the $cookies service only accepts name and value, and always sets the cookie path to the current page via self.baseHref().

Could the $cookies service be extended to provide access to additional cookie properties like path, expires, domain and secure?

I quite like the API of the jquery.cookie plugin: https://github.com/carhartl/jquery-cookie#usage. It keeps the common name=value use case simple and allows to set additional cookie properties via a third options object parameter.

I'm not very proficient in Javascript but I might try to implement something over the weekend.

reichart avatar May 11 '12 11:05 reichart

Limitations of $cookieStore forced me to port common and well-known jquery-cookie plugin as separate Angular cookie provider, check it here - https://github.com/voronianski/ngKookies

voronianski avatar Dec 28 '14 23:12 voronianski

we should look into that and see if it looks suitable for inclusion as a core module (if that sounds alright with you @voronianski)

caitp avatar Dec 28 '14 23:12 caitp

@caitp this sounds great!

voronianski avatar Dec 28 '14 23:12 voronianski

+1

zoltantarcsay avatar Jan 20 '15 12:01 zoltantarcsay

I'd love to take this one if it is available. however it looks like it has already been taken care of by this commit: d4567891b8616596d125b4dd5560dc9471d2ed63

Can any one verify this? @zoltantarcsay, since you've most recently +1ed it, is it still an issue?

gelus avatar Jan 27 '15 17:01 gelus

+1

catindev avatar Feb 03 '15 04:02 catindev

I've updated my module fix - ng-biscuit, but of course ngKookies looks more mature

stevermeister avatar Feb 03 '15 06:02 stevermeister