3

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

Ezequiel Ramiro
  • 760
  • 1
  • 12
  • 29

2 Answers2

15

@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.

Salix
  • 1,290
  • 9
  • 15
5

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

SagarPPanchal
  • 9,839
  • 6
  • 34
  • 62
larslemos
  • 61
  • 1
  • 4
  • 1
    thanks for the answer. I can't use Angular 1.5, it has to be 1.6. Anyway I ended up doing my own 'ngMessages' functionality. – Ezequiel Ramiro May 01 '17 at 18:26
  • @EzequielRamiro can you share it on a github repo or in a plunker. Next 6 months we will migrate to 1.6. Would be helpful – larslemos May 03 '17 at 14:40
  • I followed up this tuto https://www.thepolyglotdeveloper.com/2015/08/angularjs-form-validation-in-your-ionic-framework-app/ Is quite simple, but who knows if you update to 1.6, ngmessages might work to you... give it a try. – Ezequiel Ramiro May 03 '17 at 15:11
  • It works with 1.6, they just need to both be the same version is all. (see posted answer) – Salix May 24 '17 at 18:22