chaitanya chaitanya - 28 days ago 16
AngularJS Question

Argument 'SigninController' is not a function, got undefined using Grunt.js

Hi i am implementing Grunt in my application but i am getting Controller is undefined error. i tried but i didn't find any solution Please help me to solve this problem.

commonModule.exports = function(grunt) {grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),});grunt.loadNpmTasks('grunt-contrib-jshint');grunt.loadNpmTasks('grunt-contrib-concat');grunt.loadNpmTasks('grunt-contrib-uglify');grunt.loadNpmTasks('grunt-ng-annotate'); grunt.registerTask('test'['jshint','ngAnnotate','concat','uglify']);ngAnnotate: {
options: {
singleQuotes: true
}app: {
files: {
'login/js/login-controller.js',
}
}}concat: {
js: { //target
src: ['login/js/login-controller.js'],
'login/js/login-controller.js',
}}};

Answer

here is the simple javascript code which will validate both email and phone number.

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
function ValidateEmail(mail)   
{  
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;  
// if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value))  
if(mail.match(mailformat))
  {  alert(mail);
    return (true)  
  }  
    alert("You have entered an invalid email address!")  
    return (false)  
}  

function validate()
{
var data=document.getElementById("email").value;
checkNumberorEmail();

}
function phonenumber(inputtxt)  
{  
  var phoneno = /^\d{10}$/;  
  if((inputtxt.match(phoneno)))  
        {  
        alert(inputtxt);
      return true;  
        }  
      else  
        {  
        alert("enter 10 digit number");  
        return false;  
        }  
}  


function checkNumberorEmail()
{
  var data=document.getElementById("email").value;
  if (isNaN(data)) 
  {
    ValidateEmail(data)   ;

  }
  else{
  phonenumber(data) 
  }
}
</script>
</head>
<body>

<form >

<input type="text" name="email" id="email">
<input type="button" onclick="validate()">
</form>
</body>
</html>

FIDDLE