I can get a cookie as the following. I call this cookie in my module and pass it as a parameter.
How do I change the code to get a cookie so that its all in standard angularjs code?
$(document).ready(function() {
Cookie();
});
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i].trim();
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
}
return "";
}
function Cookie() {
var cookie = getCookie('Id');
}
function Module($http) {
var self = this;
self.$http = $http;
self.CookieID = getCookie('Id');
self.test = function() {
var params = {
testId: self.CookieID
}
}
}