Starting with Angular

-2

I made a small font with controller in AngularJS and when I run I get the attached error message.

Idonotknowwheretheerrormightbeconsideringthiscodeisverysimple.

Source:

<!DOCTYPEhtml><htmllang="pt-br" ng-app>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Controllers</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.min.js"></script></head><body><divng-controller="CtrlApp">
        <h1>{{nome}}</h1>
    </div>

</body>
<script type="text/javascript">
    var CtrlApp = function(){

    }
</script>
</html>
    
asked by anonymous 19.12.2017 / 17:59

1 answer

0

There are several things wrong there.

First you need to create a module, then you need to register the controller in this module and to be able to {{nome}} submit something it is necessary to bind from nome to $scope .

angular.module('app', []).controller('CtrlApp', function($scope) {
  $scope.nome = 'LINQ';
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script><divng-app="app" ng-controller="CtrlApp">
  <h1>Meu nome é {{nome}}</h1>
</div>
    
19.12.2017 / 18:13