Hi leesider,
Try below code
<div ng-app="myApp" ng-controller="ToDoController">
<ul>
<li ng-repeat="x in names">
{{ x.name + ', ' + x.country }}
</li>
</ul>
</div>
<script>
angular.module('myApp', []).controller('ToDoController', function($scope) {
$scope.todo {name: 'Wash Dog', description: 'Looking after pet'},
{name: 'Cut grass', description: 'Looking after garden'},
{name: 'Collect washing', description: 'Clothes line'},
{name: 'Buy milk', description: 'Do shopping'}
];
});
On Fri, May 29, 2015 at 4:14 PM, leesider <[email protected]> wrote:
> I am new to AngularJS so I am trying to get a simple example working. It
> is binding a div to an array
> I am getting an error Uncaught Error: [$injector:modulerr] on line 6 of
> angular.min.js:6
> It is very similar code to what is on this example:[URL="
> http://sravi-kiran.blogspot.ie/2013/02/EasyTwoWayDataBindingInHtmlPagesWithAngularJS.html
> "]
> http://sravi-kiran.blogspot.ie/2013/02/EasyTwoWayDataBindingInHtmlPagesWithAngularJS.html[/URL]
> The html code is below:
> [CODE]
> <!DOCTYPE html>
> <html ng-app="myApp">
>
> <head>
>
> </head>
>
> <body>
>
> <div ng-controller = "ToDoController">
> {{name}}
> </div>
>
>
> <script src="angular.min.js"></script>
> <script type="text/javascript" src="Myfunction.js" ></script>
>
> </body>
> </html>
> [/CODE]
>
> The Myfunction.js file is;
>
> [CODE]
> function ToDoController ($scope)
> {
> $scope.todo = [
> {name: 'Wash Dog', description: 'Looking after pet'},
> {name: 'Cut grass', description: 'Looking after garden'},
> {name: 'Collect washing', description: 'Clothes line'},
> {name: 'Buy milk', description: 'Do shopping'}
> ];
>
> }
> [/CODE]
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
Thanks and Regards,
*Kiran A*
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.