javascript - Error when upgrading to angular 1.2.22 -
i've upgraded angular 1.0.8 angular 1.2.22, following error:
error: [$injector:modulerr] http://errors.angularjs.org/1.2.22/$injector/modulerr?p0=gameapp&p1=%5b%24injector%3aunpr%5d%20http%3a%2f%2ferrors.angularjs.org%2f1.2.22%2f%24injector%2funpr%3fp0%3d%2524routeprovider%0aw%2f%3c%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a6%3a443%0agc%2fl.%24injector%3c%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a36%3a139%0ac%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a34%3a204%0ad%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a34%3a418%0ae%2f%3c%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a33%3a327%0ar%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a7%3a288%0ae%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a33%3a148%0agc%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a36%3a250%0afc%2fc%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a18%3a58%0afc%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a18%3a270%0axc%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a17%3a359%0a%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a214%3a78%0aa%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a144%3a390%0aoe%2fc%2f%3c%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a31%3a159%0ar%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a7%3a288%0aoe%2fc%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a31%3a143%0a ...p"+(c-1)+"="+encodeuricomponent("function"==typeof arguments[c]?arguments[c].tos...
i have no idea kind of error is?
here angularjs code:
var gameapp = angular.module("gameapp", []); gameapp.service('link', function() { this.user = false; }); function maketablefrom(str) { var k = 1; result = ""; for(var = 1; <= 8; i++) { result += '<tr>'; for(var j = 1; j <= 20; j++) { if(str[k] === '#') { result += '<td id=' + k + '">#</td>'; } else if(str[k] === '&') { result += '<td class="click" val="water" id="' + k + '">&</td>'; } else { result += '<td class="click" id="' + k + '"><a href="#"></a></td>'; } k++; } result += '</tr>'; } return result; } gameapp.config(function($routeprovider) { $routeprovider .when('/', { templateurl : 'partials/firstpage.html', controller : 'firstpagectrl' }) .when('/game', { templateurl : 'partials/game.html', controller : 'gamectrl' }); }); gameapp.controller("firstpagectrl", function($scope,$http,link,$location) { $scope.dologin = function() { $http.post("lib/action.php", {username: $scope.username, password: $scope.password}).success(function(data) { if(data) { link.user = data; console.log(link.user); $location.path("/game"); } }).error(function(data) { console.log(data); }); }; }); gameapp.controller("gamectrl", function($scope,$http,link,$location) { //$scope.trr = [1,2,3,4,5,6,7,8]; //$scope.tdd = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]; $scope.getmonsters = "1"; var map; $http.post("lib/action.php", {monsters: $scope.getmonsters}).success(function(data) { map = data; console.log(map); $scope.result = maketablefrom(data); console.log(result); }); if(link.user) { /*$scope.message = "fisk"; console.log(link.user);*/ } else { /*$scope.message = "ledsen fisk"; console.log("Är inte satt");*/ } });
anyone can me resolve error? happens when upgrade 1.0.8 1.2.22
you'll notice error has url in it, can click on more information.
at version 1.2.0, angular split out modules such ngroute
, etc. replaced 3rd party versions (e.g. uirouter).
as such, need add v. 1.2.22 of angular-route.js
page continue using $routeprovider
.
you can either bower install angular-route
(if use bower), or download or reference here
you need add ngroute
dependency gameapp
:
var gameapp = angular.module("gameapp", ['ngroute']);
note: may happen if have used other modules part of core, fix same.
Comments
Post a Comment