我想要使用cookie(设置和检索),我有这个代码从一个站点复制并更改它,但我不会工作,我所有的角部分停止工作。 这是一个角网站样本 你能告诉我问题在哪里吗?问题在角js使用cookie
var app = angular.module('test', ['ui.bootstrap'], ['ngCookies']);
app.controller('ExampleController', ['$cookieStore', function ($scope, $cookieStore) {
// Put cookie
$cookieStore.put('myFavorite', 'oatmeal');
// Get cookie
$scope.itemValue = $cookieStore.get('myFavorite');
// Removing a cookie
//$cookieStore.remove('myFavorite');
}]);
和用法是:
<span ng-controller="ExampleController">{{itemValue}}</span>
它给了我这个错误
Error: [$injector:modulerr] http://errors.angularjs.org/1.3.0-beta.5/ $injector/modulerr?......
它显示任何错误信息 – vamsikrishnamannem 2015-02-23 14:01:15
yes:ReferenceError:$ scope没有定义;错误:[$ injector:modulerr] http://errors.angularjs.org/1.3.0-beta.5/$ ....................... .............. – MasOud 2015-02-23 19:05:31