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
    • 69
    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

    $cookies.get('CustomerCode')

    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

    $cookies.remove('CustomerCode');

    It simply removes the value in Cookies.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: