Reading a json file with angular

0

I have problems reading a json file, the problem is that the json file does not read it, I show code.

<!DOCTYPE html>
<html lang="en" ng-app="datosApp">
<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>Importar datos</title>
<script src="js/angular.min.js"></script>
</head>
<body>

<div ng-controller="controladorDatos">
    <h1>A-Team</h1>
    <p>{{equipo.historia}}</p>
    <ul>
        <li ng-repeat="integrante in equipo.integrantes">
            {{integrante.rango}} {{integrante.nombre}} {{integrante.especialidad}}
        </li> 
    </ul>
</div>



<script>
    var misDatos = angular.module('datosApp', []);
    misDatos.controller('controladorDatos', function($scope, $http){

        $scope.importar = function(){
            $http.get('datos.json').success(function(datos){
                $scope.equipo = datos;

            });
        }

        $scope.importar();
    });
</script>

json file

{
"integrantes": [
    {
        "nombre": "john Hannibal Smith",
        "especialidad": "Estrategia",
        "rango": "Coronel"
    },
    {
        "nombre": "Templetom Peck",
        "especialidad": "Logistica",
        "rango": "Teniente"
    },
    {
        "nombre": "H. M. Murdock",
        "especialidad": "Piloto",
        "rango": "Capitan"
    },
    {
        "nombre": "B. A. Baracus",
        "especialidad": "Artilleria",
        "rango": "Sargento"
    }
],
"historia": "Hace 10 años un tribunal militar condenó a prosión a un grupo de comandos pro un crimen que no cometieron. esos hombres"

}

Error:

    
asked by Pedro Ávila 17.09.2018 в 23:03
source

0 answers