0

I'm new to angularjs and i'm doing a simple test script. According to the video tutorial i'm watching the code is correct. But does not run in my browser.

<!doctype html>
<html lang="en" ng-app>
    <head>
        <meta charset="UTF-8">
        <title>Angular Demo</title>
        <script src="lib/angular/angular.min.js"></script>
    </head>

<body>
<div ng-controller = "MyController">
    <h1>{{author.name}}</h1>
    <p>{{author.title + ',' + author.company}}</p>
</div>
<script>
function MyController($scope){
$scope.author = {
'name' : 'palitha ',
'title'  : 'test',
'company' : 'Home company'
}}
</script>
</body>
</html>

Can anybody show me where i got wrong.

Phil
  • 157,677
  • 23
  • 242
  • 245
koli
  • 194
  • 1
  • 6
  • 24

1 Answers1

2

Man The videos you are seeing are old and the way they have shown to make a controller is also old this is not the way to make controller anymore in angular.

var app=angular.module('adb',[]);
app.controller('AppCtrl',function($scope){

});

or use the same angular version as the one in video you might be seeing lynda's angular tutorial see this one.

FatalError
  • 560
  • 2
  • 18
Yashdeep Hinge
  • 382
  • 2
  • 14
  • yes vengicx i think so. The video tutorial is somewhat old and i'm using the angularjs 1.3.15 which is the latest one. – koli May 04 '15 at 05:13