如何清除angular.js饼干 [英] How to clear cookies in angular.js

查看:158
本文介绍了如何清除angular.js饼干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前正在使用angulajs应用程序。

Currently am using angulajs app.

我想一些值存储在cookie中。所以我用角饼干分钟脚本完成某些值添加到饼干

I want to store some values in cookie. So i used angular-cookies-min script for add some values to cookies

我用低于code本作的值保存到cookie中。

I have used this below code for save values to cookie.

 $cookieStore.put("userInfo", userInfo);//userInfo is a array with some values. 

现在我要清除的饼干吗?我该怎么办呢?

推荐答案

试试这个code为删除Cookie

Try this code for delete cookie

$cookieStore.remove("userInfo");

修改:由于V1.4 $的CookieStore 已去precated(见的文档),因此从该版本的你应该使用:

EDIT: Since v1.4 $cookieStore has been deprecated (see docs), so from that version on you should use:

$cookies.remove("userInfo");

这篇关于如何清除angular.js饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆