I'm new to both Angular and cookies, I have an HTML template that I need to display the first time a user visits my app. However the next time they visit they should no longer see that template and see the default template.
So far I found solutions posted here and here.
However both solutions threw errors, in the 1st link ==
didn't work, the next example string is not a function
How would this code below work to check to see if there is a cookie, if none then create the cookie.
// Controller for Dashboard
app.controller('DashboardController', ['$scope', '$cookies', '$cookieStore', function ($scope, $cookies, $cookieStore) {
// if cookie does not exits show welcome template
// create cookie
// if cookie welcome exits show default template
$scope.welcome = $cookieStore.get('welcome');
$scope.checkCookie = function(welcome){
$scope.welcome = welcome;
$cookieStore.put('cookie', welcome);
};
// $cookieStore.put("name","my name");
// $cookieStore.get("name") = "my name";
// $cookieStore.remove("name");
}]);