Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
angular-cookies
Advanced tools
The angular-cookies npm package provides a convenient way to read, write, and delete browser cookies in AngularJS applications. It simplifies cookie management by offering a set of services that can be easily integrated into AngularJS components.
Setting a Cookie
This feature allows you to set a cookie with a specified key and value. In this example, a cookie named 'myFavorite' is set with the value 'oatmeal'.
angular.module('myApp', ['ngCookies'])
.controller('CookieController', ['$cookies', function($cookies) {
$cookies.put('myFavorite', 'oatmeal');
}]);
Getting a Cookie
This feature allows you to retrieve the value of a cookie by its key. In this example, the value of the 'myFavorite' cookie is retrieved and logged to the console.
angular.module('myApp', ['ngCookies'])
.controller('CookieController', ['$cookies', function($cookies) {
var favoriteCookie = $cookies.get('myFavorite');
console.log(favoriteCookie); // Outputs: oatmeal
}]);
Removing a Cookie
This feature allows you to remove a cookie by its key. In this example, the 'myFavorite' cookie is removed.
angular.module('myApp', ['ngCookies'])
.controller('CookieController', ['$cookies', function($cookies) {
$cookies.remove('myFavorite');
}]);
js-cookie is a simple, lightweight JavaScript API for handling cookies. It provides similar functionalities to angular-cookies but is framework-agnostic, making it suitable for use in any JavaScript project, not just AngularJS.
ngx-cookie-service is an Angular package for managing cookies in Angular applications. It offers a more modern approach compared to angular-cookies and is designed to work with Angular (2+), providing a TypeScript-friendly API.
universal-cookie is a JavaScript library for handling cookies in both client and server environments. It is framework-agnostic and can be used in various JavaScript frameworks, including React and Angular, making it more versatile than angular-cookies.
This repo is for distribution on npm
and bower
. The source for this module is in the
main AngularJS repo.
Please file issues and pull requests against that repo.
You can install this package either with npm
or with bower
.
npm install angular-cookies
Then add ngCookies
as a dependency for your app:
angular.module('myApp', [require('angular-cookies')]);
bower install angular-cookies
Add a <script>
to your index.html
:
<script src="/bower_components/angular-cookies/angular-cookies.js"></script>
Then add ngCookies
as a dependency for your app:
angular.module('myApp', ['ngCookies']);
Documentation is available on the AngularJS docs site.
The MIT License
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
AngularJS module for cookies
The npm package angular-cookies receives a total of 68,503 weekly downloads. As such, angular-cookies popularity was classified as popular.
We found that angular-cookies demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.