永井です。こんばんは。
anglurjsでcookieを扱ってみようとチュートリアルstep2(http://docs.angularjs.org/tutorial/step_02)をベースに
angular.module('MyAppModule', ['ngCookies']);
'use strict';
/* Controllers */
function PhoneListCtrl($scope, $cookies) {
$cookies.NameOfMyCookie = "Setting a value"; // 追加コード
alert($cookies.NameOfMyCookie);
$scope.phones = [
{"name": "Nexus S",
"snippet": "Fast just got faster with Nexus S."},
{"name": "Motorola XOOM™ with Wi-Fi",
"snippet": "The Next, Next Generation tablet."},
{"name": "MOTOROLA XOOM™",
"snippet": "The Next, Next Generation tablet."}
];
}
というコードを書いてみたのですが、chromeにて実行してみると
Error: Unknown provider: $cookiesProvider <- $cookies
at Error (<anonymous>)
at file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:2696:15
at Object.getService [as get] (file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:2824:39)
at file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:2701:45
at getService (file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:2824:39)
at invoke (file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:2842:13)
at Object.instantiate (file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:2874:23)
at file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:4759:24
at file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:4338:17
at forEach (file://localhost/Users/nagaitomoyuki/Desktop/angular-phonecat/app/lib/angular/angular.js:138:20)
というエラーが起きてしまいます。
おそらく1行コードをかけば解決というレベルの話だと思うのですが
原因はなにかわかる方いらっしゃらないでしょうか?