JavaLearner1 JavaLearner1 - 1 year ago 82
AngularJS Question

AngularJS Cookies - Cookies saved in Browser but not displaying

I have injected the cookies and i am saving the value in cookies like this,

$ = "Alfred";
console.log("cookie " +$;

and in HTML i display


the cookies are getting saved and displayed in console, But in HTML it is not getting displayed. I have checked the chrome browser too, the cookies are saved in localhost..

Answer Source

you need to have a scope variable to display it

$ = "Alfred";
$scope.cookiname = $ ;


<div>Name: {{cookiname}}</div>

Here is the working App

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download