this question may be a very very basic question of Angular.JS. May be nearly this question is asked in StackOverFlow before, but I am unable to find the question, so I have to ask this question.
I am pretty new in Angular.JS and I am trying to create a basic form with Angular.JS which will validate an email address from given input.
What is working for me is-
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<form ng-app="" name="myForm">
Email:
<input type="email" name="myAddress" ng-model="text">
<span ng-show="myForm.myAddress.$error.email">Not a valid e-mail address</span>
</form>
<p>Enter your e-mail address in the input field. AngularJS will display an errormessage if the address is not an e-mail.</p>
But what I am trying to give a name of my angular app like this- ng-app="my_try_app" so my code has been like this-
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<form ng-app="my_try_app" name="myForm">
Email:
<input type="email" name="myAddress" ng-model="text">
<span ng-show="myForm.myAddress.$error.email">Not a valid e-mail address</span>
</form>
<p>Enter your e-mail address in the input field. AngularJS will display an errormessage if the address is not an e-mail.</p>
And u are seeing it is not working.
So, my question is-
What is the way of giving my angular app a name?
Why in my case it is not working?
Thanks in advance for helping.