Search Posts

Category: angular-cookies

Data only displayed after refresh AngularJS

I’m using plain controller to make cart system and $ngcookies. Everything works but the only thing that My Data (.name) only displayed at cart after browser refresh/reload, to be honest main HTML and Cart.html in different controller/view ($ngroute). Is there any mistake i made to fix this? Any help will be appreciated. I want my data displayed (live) on click instead of after Refresh HTML <div ng-controller=”AliceController” class=”talent-container”> <div ng-repeat=”talent in talents”> <button type=”button” href=”#” […]

$cookies.get is not a function – Angular JS

Designed two pages. Cookies is not set and showing error. CDN: <script src = “https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.min.js”></script> <script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular-cookies.js”></script> Main Page – Set Cookies / cookies is not set var app = angular.module(‘myApp’, [‘ngCookies’]); app.controller(‘LoginCtrl’, [‘$cookies’, ‘$scope’, ‘$http’, ‘$window’, ‘$location’, function($cookies,$scope, $http, $window, $location) { $cookies.put(‘username’, ‘name’); } Second Page – Get Cookies var app = angular.module(‘myApp’, [ ‘ngTable’, ‘ngCookies’ , ‘ngResource’]); app.controller(‘AccountMappingCtrl’, [‘$scope’, ‘$http’,’$cookies’, ‘NgTableParams’, function($scope, $http, $filter, $cookies, NgTableParams) { $scope.UsernameCookies = $cookies.get(“username”); } It […]