Page does not work with Angular - beginner doubt

0

I'm starting with Angular but it happens to me what ever happens with the one starting the framework, but I'm not giving it a go. I can not do it and it works, it seems to me that something imperceptible breaks the operation of the script and its execution on the page more I've tried everything, see:

   var app = angular.module('loja',['ngRoute', 'ngResource']); //

app.controller('primeiroController', ['$scope', function($scope){

    $scope.objetoPessoa = 'Novo Valor';
    console.log($scope.objetoPessoa);

    $scope.getPorId = function(){

        console.log('fdsfsdgf');

    }

}]);

app.controller('pessoaController', ['$scope', '$resource', function($scope, $resource){

    pessoas = $resource("/bookstore_angular_spring/pessoas/?codPessoa=:codPessoa");

    $scope.getPorId = function(){

        console.log('fdsfsdgf');

        pessoas.get({codPessoa: $scope.codPessoa}, function(data){
            $scope.objetoPessoa = data;
        });
    }

}]);


app.config(function($routeProvider) {
    $routeProvider
    .when("/", {controller: "pegarResposta", templateUrl: "list.html"})
    .when("/edit/:name", {controller: "editController", templateUrl: "form.html"})
    .when("/new", {controller: "newController", templateUrl: "form.html"})
    .otherwise({redirectTo: "/"});
});

app.run(function($rootScope){
    $rootScope.frutas = ['banana', 'melancia', 'pera'];
});


app.controller('listController', ['$scope', function($scope){

}]);

In the html file I have:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html ng-app="loja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js"></script><scripttype="text/javascript" src="script/angular-resource.js"></script> 

<script type="text/javascript" src="script/angular-route.js"></script>
<!-- 
<script type="text/javascript" src="script/primeiroController.js"></script>
 -->
<script>

</script>
</head>
<body ng-controller="primeiroController" ng-init="objetoPessoa='burro'">

    <input type="text" ng-value="100" ng-model="codPessoa" />
    <hr>
    <button ng-click="getPorId();">Buscar por Id</button>
    <hr>
    <button ng-click="getTodos();">Budscar todos</button>
    <hr>
    <button ng-click="salvarPessoa();">Salvar pessoa</button>
    <hr>
    <button ng-click="deletarPessoa();">Deletar pessoa</button>
    <hr>

    <h1>{{objetoPessoa}}</h1>

</body>
</html>
    
asked by anonymous 25.09.2017 / 19:21

1 answer

0

I was missing the ng-app attribute with no value in the html tag, thanks for the answers

    
26.09.2017 / 14:14