Uncaught TypeError: angular.lowercase is not a function

后端 未结 8 1498
感动是毒
感动是毒 2021-02-02 08:58

Uncaught TypeError: angular.lowercase is not a function

this error in my angularjs application, and entire application is not running. This

8条回答
  •  隐瞒了意图╮
    2021-02-02 09:57

    I would like to share my views so that it will help other people who are struggling like me, the main problem is angularJS officially removed lowercase and uppercase functions from their library so people who are using textAngular-sanitize.js will get this error because textangular still has this method in its library which will through this issue.

    You can either remove textAngular-sanitize.js from your project or you can include Ovidiu Dolha code in you app.js before angular.module loads as below.

    angular.uppercase=function(text){
     return text.toUpperCase();
     }
     angular.lowercase=function(text){
     return text.toLowerCase();
     }
    
    angular.module('sampleApp', ....)
    

    The code given by Ovidiu Dolha

    angular.lowercase = text => text.toLowerCase();
    

    Can be written as

    angular.lowercase=function(text){
         return text.toLowerCase();
         }
    

    Both will work. Thank you.

提交回复
热议问题