ngSanitize module inject error

user6086008 picture user6086008 · Mar 21, 2017 · Viewed 7.7k times · Source

I am trying to use angular-sanitize in angularJS.

I require angular-sanitize and inject it in my module.

But i get the following errors:

Uncaught TypeError: f.module(...).provider(...).info is not a function

Uncaught Error: [$injector:modulerr]

app.js

const angular_sanitize = require('angular-sanitize/angular-sanitize.min.js');  

var app = angular
  .module('myApp', ['ngSanitize'])

It works if i am using a script in index.html, but i want it to work as a module dependency instead.

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-sanitize.min.js"></script>

Answer

Teddy picture Teddy · Apr 5, 2017

Had the same issue, not sure if the same fix but might help.. so.. in bower.json I had "angular-sanitize": "^1.5.5" and on bower install it pulled the latest version 1.6.4 which has breaking changes for my installed angular version 1.5.9.. Try to install the ng-sanitize version that works for your build