为什么ng-repeat被我的MEAN堆栈应用程序注释掉了?

时间:2016-11-05 20:20:17

标签: javascript angularjs mean-stack

我正在尝试用我的MEAN堆栈应用程序做一个简单的跟踪子弹。我一直试图让我的app.js文件在我的服务器中与我的app.js在我的视图中进行通信。这是index.html

<!DOCTYPE html>
<html ng-app="allInOne">
<head>
  <link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.min.css" />
  <link rel="stylesheet" type="text/css" href="/stylesheets/normalize.css" />
  <link rel="stylesheet" type="text/css" href="/stylesheets/XXX.css" />
  <script type="text/javascript" src="/src/angular.min.js"></script>
  <script type="text/javascript" src="/src/app.js"></script>
</head>

<body>
<!--  header  -->
<header>
  <h1 class="text-center">XXX</h1>
  <h4 class="text-center">All In One</h4>
</header>

<!--  containers / content  -->
<div class="container">
    <!-- Stack the columns on mobile by making one full-width and the other half-width -->
    <div class="row">
        <div class="col-xs-12 col-sm-6 col-md-8 content-prime">
            <h3>
                .col-xs-12 .col-sm-6 .col-md-8.
            </h3>
            <div class="notice-pre-content">
                holy crap here's an alert, or factoid
            </div>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        </div>
        <div class="col-xs-6 col-md-4 nav-prime"><h3>.col-xs-6 .col-md-4.</h3><p>Navigation on the right can go here. Yep yep yep. On the right side. Here it is. Yaaargghh. Yep. Yep. Yep. Navigation on the right can go here. Yep yep yep. On the right side. Here it is. Yaaargghh. Yep. Yep. Yep.</p></div>
    </div>
    <div class="row">
        <div class="col-xs-6 col-sm-4">Bot left, m8.</div>
        <div class="col-xs-6 col-sm-4">.col-xs-6 .col-sm-4</div>
        <!-- Optional: clear the XS cols if their content doesn't match in height -->
        <div class="clearfix visible-xs-block"></div>
        <div class="col-xs-6 col-sm-4"><h5>.col-xs-6 .col-sm-4. Bot right.</h5></div>
    </div>
</div>

<div>
    <ul ng-contoller="testController">
        <li ng-repeat="element in list"> {{element}} </li>
    </ul>
</div>
<!-- footer -->
<footer>
        <h5 class="text-center">link dump: google+, facebook, twitter, green initiative, member fdic </h5>
</footer>

</body>
</html>

我认为问题出在ng-controller中,但我不确定。

<div>
    <ul ng-contoller="testController">
        <li ng-repeat="element in list"> {{element}} </li>
    </ul>
</div>

服务器/ app.js

let express = require("express");

let app = express();

app.use( express.static(__dirname + "/../views") );

let bodyParser = require('body-parser');
let jsonParser = bodyParser.json();


app.get("/test", (request, response) => {
    response.json( ["Hello", "World"]);
});
app.listen(81, 'codeone2016.erikshafer.me');

视图/ SRC / app.js

var app = angular.module('allInOne', []);

app.controller('testController', ($scope, $http) => {
    $http.get('/test')
        .success(function(response) {
            console.log(response);
        })
        $scope.results = response.results;
});

0 个答案:

没有答案