Ngmessages Uncaught TypeError l.module(…).info is not a function

∥☆過路亽.° 提交于 2019-12-07 15:15:41

问题


I've installed Angular-Messages to my Ionic V1 App but I cannot make it work.

Error:

Uncaught TypeError: l.module(...).info is not a function at angular-messages.js:267
at angular-messages.js:6

This is my index.html:

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>
    <script src="js/sha1.js"></script>

<script src="lib/ionic-material/dist/ionic.material.min.js"></script>
<script src="lib/angular-messages/angular-messages.min.js"></script>

and in my app.js

var app = angular.module('starter', ['ionic', 'ngCordovaOauth', 'ionic-material', 'ngMessages'])

Reading a bit I thought that could be a version problem between angular, angular-animate and angular-messages, which they have to be at the same version to be compatible.

Bower packages list - bower.json:

  "dependencies": {
    "ng-cordova-oauth": "^0.2.6",
    "angular": "~1.6.4",
    "angular-animate": "~1.6.4",
    "angular-messages": "~1.6.4"
  }

But nothing.. still getting the same error. What else could it be? Any ideas?

Thanks


回答1:


@larslemos' answer help me find the solution to my similar problem.

I was working with '.../libs/angular.js/1.6.1/angular.min.js'
but using '.../libs/angular-messages/1.6.4/angular-messages.min.js'.

Changing to angular 1.6.4 or ngMessages 1.6.1 did solved the issue.

So basically just make sure they are the same version, no need to go to 1.5.




回答2:


I just had the same issue while coding in angular 1.6

So I had to change my angular message in bower.json to this:

    "dependencies": {
    "angular": "~1.5",
    "angular-messages": "~1.5"
    "angular-animate": "^1.6.2",
    "angular-bootstrap": "^2.5.0",
    "angular-route": "^1.6.2",
    "bootstrap": "^3.3.7",
    "lodash": "^4.17.4",
    "spin.js": "^2.3.2",
    "moment": "^2.17.1",
    "toastr": "^2.1.3",
    "jquery": "^3.1.1",
    "angular-ui-router": "^0.4.2",
    "angular-sanitize": "^1.6.3",
  },

Hope it helps



来源:https://stackoverflow.com/questions/43415827/ngmessages-uncaught-typeerror-l-module-info-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!