I have recently delved into learning angular JS and I find myself struggling with some basic concepts.
Current Situation: I am experimenting with two strings - postNumber123
and 123preNumber
. Angular is throwing an error when the string starts with a number, but it works fine if it starts with characters. I am curious to understand the reason behind this behavior. Am I overlooking something?
Angular behaving as expected:
<div ng-app="" >
<div> Testing : {{ postNumber123 }} </div> <!-- no error -->
<div>After execution : {{ 3+4 }} </div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="" >
<!-- <div> Testing : {{ 123preNumber }} </div> --> <!-- showing error -->
<div> Testing : {{ postNumber123 }} </div> <!-- no error -->
<div>After execution : {{ 3+4 }} </div>
</div>
Error encountered for this scenario:
<div ng-app="" >
<div> Testing : {{ 123preNumber }} </div> <!-- displaying error -->
<div>After execution : {{ 3+4 }} </div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="" >
<div> Testing : {{ 123preNumber }} </div> <!-- displaying error -->
<!-- <div> Testing : {{ postNumber123 }} </div> --> <!-- no error -->
<div>After execution : {{ 3+4 }} </div>
</div>
Thank you!