The directive ng-repeat
is not working properly when we give ng-app="MyApp"
and which is working without passing any value to the ng-app
directive which is a strange behaviour to me. I am new to the AngularJS. Is this behaviour expected?
Please throw some light on this.
<!DOCTYPE html>
<html>
<head>
<title>Books Buddy</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body ng-app="MyApp">
<div ng-init="books=['EffectiveJava','ServletBlackbook','CodeCleaner','HeadFirstJava']">
<ul>
<li ng-repeat="book in books">{{book}}</li>
</ul>
</div>
</body>
</html>
This is your way (here we are doing every thing in html only so we don't need custom app.. we can just say "hey angular just do what you can do with things")
This is a correct way (in this we are declaring our own app so we need to set a name for our app..)