I created this code to check if value is number or not but it doesn't seem to work.
app.controller('ForCtrl', function($scope) {
$scope.calcul_factorielle = function() {
var mm = 1;
if ((typeof ($scope.test) !== 'number')) $scope.factorielle = " invalide saisie";
for(i=2;i<=$scope.test;i++) {
mm = mm * i;
}
$scope.factorielle = mm;
}
});
Why, when I'm entering string stackoverflow am I not receiving the 'invalide saisie' message in the output?