Richie
Richie

Reputation: 5199

Angular.js Hello World difference between 1.2.0 and 1.4.7

I have a really simple Angular.js Hello World application. When I include version 1.2.0 the application works but when I include 1.4.7 the application does not work.

<body ng-app>

<!-- works with 1.2.0 -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>

<!-- Does not work with with 1.4.7 -->
<!--script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script-->


<div ng-controller="AppCtrl">
    Hello {{name}}
</div>

<script type="text/javascript">
    var app = angular.module('app',[]);

    function AppCtrl($scope) {
        $scope.name = 'Sally';
    }
</script>

</body>

Can someone help me with what might be wrong here?

thanks

Upvotes: 0

Views: 679

Answers (1)

Anik Islam Abhi
Anik Islam Abhi

Reputation: 25352

That format is no longer supported from 1.3.x

You have to complete process in order to continue

Like this

<body ng-app='app'>

<!-- works with 1.2.0 -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>

<!-- Does not work with with 1.4.7 -->
<!--script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script-->


<div ng-controller="AppCtrl">
    Hello {{name}}
</div>

<script type="text/javascript">
    var app = angular.module('app',[]);
    function AppCtrl($scope) {
        $scope.name = 'Sally';
    }
    app.controller("AppCtrl",AppCtrl);
</script>

</body>

Upvotes: 1

Related Questions