NgSanitize module input error

I am trying to use angular-sanitize in angularJS.

I require angular-sanitize and insert it into my module.

But I am getting the following errors:

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

Unprepared 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 use the script in index.html, but I want it to work as a module dependency.

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

      

+3


source to share


2 answers


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



+5


source


if you are loading resource from local folder (static resource) check if path is correct in below (modified) rule and folder and file exist.

require('./angular-sanitize/angular-sanitize.min'); 

      



Otherwise, if you are loading from a CDN resource since you are in your HTML, you may need to customize your requirejs config object and map it to the CDN. Post below -

Loading Bootstrap from CDN with Require.js

+1


source







All Articles