angularjs - Angular ngCookies -
i can't inject ngcookies angular module project. tell me why. have done instructions wich in documentation. write 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 like:
angular.js:68 uncaught error: [$injector:modulerr] failed instantiate module mainapp due to: error: [$injector:modulerr] failed instantiate module ngcookies due to: error: [$injector:nomod] module 'ngcookies' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. http://errors.angularjs.org/1.4.4/$injector/nomod?p0=ngcookies
would if changed script source adding 1 's' letter end of angular-cookie , before '.js', below :
<script src="assets/js/angular-cookie/angular-cookies.js"></script>
based on angular-ngcookies api, it's used this:
<script src="angular-cookies.js">
They are amazingly written. The data binding feature of AngularJS helps in automatically synchronising the data between model and view components. If you are looking for freelancing projects, then companies are hiring angular js developers by posting their requirements on Eiliana.com-a global freelancing portal.
ReplyDelete