The ngCookies module provides a convenient wrapper for reading and writing browser cookies. By using cookieStore and cookie, we can read and write cookies. Add angular and angular-cookie script to your page.
<script src="http://code.angularjs.org/1.0.0rc10/angular-1.0.0rc10.js"></script> <script src="http://code.angularjs.org/1.0.0rc10/angular-cookies-1.0.0rc10.js"></script>
Using $cookieStore
angular.module('myApp', ['ngCookies']); function CookieCtrl($scope, $cookieStore) { $scope.setCookie = function(){ $cookieStore.put('name', 'srinivas'); alert('cookie was set'); }; $scope.readCookie = function(){ alert($cookieStore.get('name')); }; $scope.removeCookie = function(){ $cookieStore.remove('name'); alert('cookie was removed'); }; }
Using $cookies
angular.module('myApp', ['ngCookies']); function CookieCtrl($scope, $cookies) { $scope.setCookie = function(){ $cookies.name = 'srinivas'; alert('cookie was set'); }; $scope.readCookie = function(){ alert($cookies.name); }; $scope.removeCookie = function(){ $cookies.name = null; alert('cookie was removed'); }; }
https://www.guest-articles.com/education/1z0-1067-oracle-cloud-infrastructure-2019-cloud-operations-associate-02-12-2020
ReplyDeleteGood blog. Keep sharing. I love them Are you also searching for Cheap assignment help? we are the best solution for you. We are best known for delivering cheap assignments to students without having to break the bank
ReplyDelete