veda
veda

Reputation: 91

angular.module(...).provider(...).info is not a function

My mean.js app is running in my local system but when upload on server it throws error like

angular.module(...).provider(...).info is not a function at angular-sanitize.js:714
at angular-sanitize.js:913

anyone help me solved this

Upvotes: 2

Views: 4686

Answers (1)

Senal
Senal

Reputation: 1620

It should work fine for your previous versions, see the below snippet:

var app = angular.module("myApp", ['ngSanitize']);
app.controller("myCtrl", function($scope) {
    $scope.myText = "<a href='http://google.com'>Google</a>";
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.11/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-sanitize.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">

    <p ng-bind-html="myText"></p>

</div>

However I was able to recreate your issue with different versions like below check the console:

var app = angular.module("myApp", ['ngSanitize']);
app.controller("myCtrl", function($scope) {
    $scope.myText = "<a href='http://google.com'>Google</a>";
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.11/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.3/angular-sanitize.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">

    <p ng-bind-html="myText"></p>

</div>

One should always use same versions for all of your angularjs libraries. In some cases you might not get errors even when you use different versions, that is because you were not using breaking changes between those versions.

var app = angular.module("myApp", ['ngSanitize']);
app.controller("myCtrl", function($scope) {
    $scope.myText = "<a href='http://google.com'>Google</a>";
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular-sanitize.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">

    <p ng-bind-html="myText"></p>

</div>

see the above versions of angular 1.7.2 it works fine, maybe you will have to clear your cache and try again.

Upvotes: 3

Related Questions