I cannot embed the ngCookies angular module in my project. Could you tell me why. I followed all the instructions that were in the documentation. Write down the true code, if possible, plz.
var mainApp = angular.module('mainApp',["ngCookies","ngRoute"]).config(appConfig); appConfig.$inject=['$routeProvider','$cookieStore','$cookies']; function appConfig ($routeProvider){ $routeProvider .when( '/add', { templateUrl:"view/add/index.html" } ) .when( '/login',{ templateUrl:'view/login/index.html', controller:'loginController' } ) .otherwise({ redirectTo:'/' }) };
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script src="assets/js/jquery/dist/jquery.js" charset="utf-8"></script> <script src="assets/js/angular/angular.js" charset="utf-8"></script> <script src="assets/js/angular-cookie/angular-cookie.js"></script> <script src="assets/js/angular-route/angular-route.js" charset="utf-8"></script> <script src="assets/js/angular-resource/angular-resource.js" charset="utf-8"></script> <script src="assets/js/app/main.js" charset="utf-8"></script> <script src="assets/js/app/controllers/loginController.js"></script> <script src="assets/js/app/services/userLogin.js"></script> </head> <body> <div ng-app = "mainApp" class="main"> <a id="add" href="#add"></a> <a href="#"></a> <a href="#login"></a> <div ng-view> </div> </div> </body> </html>
Error:
angular.js: 68 Error in the absence of: [$ injector: modulerr] Unable to instantiate the mainApp module because of: Error: [$ injector: modulerr] Unable to create the ngCookies module because of: Error: [$ injector: nomod] The 'ngCookies' module is not available! You either mistakenly wrote the name of the module, or forgot to load it. If registering a module ensures that you specify the dependencies as the second argument. http://errors.angularjs.org/1.4.4/ $ injector / nomode? p0 = ngCookies
source share