Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Cookies in Angular JS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 283
    Comment on it

    Cookies are the information of the user, which resides in a browser of any corresponding website he/she visited.
    Cookies are also the important aspects which we use to maintain session.

    Here we perform some basic operation in cookie by using AngularJS.

    first, to perform operations we need to call a service ngCookies.

    GET operation


    Here we taking the value of customer code which is already saved in cookies.

    Here is some implementation:

    angular.module('myApp', ['ngCookies'])
    .controller('myController', ['$cookies', function($cookies) {
      var favoriteCookie = $cookies.get('CustomerCode');

    UPDATE operation

    $cookies.put('CustomerCode', 'A9m4pw1xZ');

    In the above piece of code, we have set the value of Customer code.

    DELETE operation


    It simply removes the value in Cookies.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: