angularjs - Cannot find module with name 'my'. Cannot find controller with name 'mycontroller' -


error_screenshot hi getting following error

please help.

error : cannot find module name "my". , also

multiple annotations found @ line:-

cannot find module name my. cannot find module name my. cannot find controller name mycontroller

please help. able run code though error exists.

.my code below`

<!doctype html> <html ng-app="my"> <head> <script src="angular.js"></script> <script>     var validation = angular.module('my', []);     validation.controller('mycontroller' , function($scope) {         $scope.firstname = "madhuri";         $scope.email = "madhuri@gmail.com";         $scope.age = "24";         $scope.pattern = /^\d*$/;     });  </script> </head>  <body >     <div ng-controller="mycontroller">         <form name="form1">             <label>name :</label> <input type="text" name="name" ng-model="firstname" required>              <span style="color: red" ng-show="form1.name.$error.required"> please provide name</span>              <br>              <br>              <label>email: </label> <input type="email"                 name="email" ng-model="email">              <span style="color: red" ng-show="form1.email.$error.email"> please provide valid email address </span>              <p style= "color: red" ng-show="form1.email.$error.email">please provide valid email address</p>               <label>age :</label>              <input type="text" name="age" ng-model="age" ng-pattern="pattern">              <span style="color: red" ng-show="form1.age.$error.pattern"> please provide correct age             </span>         </form>     </div> </body> </html> -->` 

try changing how instantiating controller. try this:

<script> var validation = angular.module('my', []); angular.module('my').controller('mycontroller' , function($scope) {     $scope.firstname = "madhuri";     $scope.email = "madhuri@gmail.com";     $scope.age = "24";     $scope.pattern = /^\d*$/; }); </script> 

alternatively instantiate this:

<script> var validation = angular.module('my', []).controller('mycontroller' , function($scope) {     $scope.firstname = "madhuri";     $scope.email = "madhuri@gmail.com";     $scope.age = "24";     $scope.pattern = /^\d*$/; }); </script> 

i have added jsfiddle works both ways show work

jsfiddle


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -