I use a Math.random() function in a AngularJS Code
$scope.runFull = function () {
var rand;
do {
rand = Math.random();
...
} while ($scope.cond < 5400); // 90 minutes
};
$scope.runFull();
My Chrome console return javascript TypeError: Math.random is not a function
I put Math in watcher and I find Math.abs, Math.acos, Math...., Math.random, Math....
either Math or Math.random is overridden. run Math.random() as you first line of code and see what happens.
My error was : angular.module('xxxxxApp') .controller('FullController', function ($scope, $interval, xxxxService, yyyyService, ..., Math , Principal) {
YES, thank you very much everyone, I have a angularjs service named "Math".
Solution: I rename my "Math" service in "Mathematic" and I can use Math.random() :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.