【问题标题】:Angular-fullstack: PostgreSQL DB created, but can't get dataAngular-fullstack:已创建 PostgreSQL 数据库,但无法获取数据
【发布时间】:2016-12-28 14:57:40
【问题描述】:

我是 angularjs 新手,我正在尝试使用 yeoman 和 PostgreSQL 使用 generator-angular-fullstack 设置第一个项目。一切似乎都在工作。

当我在 localhost (grunt serve) 上使用 grunt 时,我看到一个基本的 yeoman 页面,但没有数据。创建一个数据库和表。有一些测试数据。看起来从项目到数据库的连接正在工作,但它无法访问数据。

development.js 中的数据库配置:

module.exports = {
  // MongoDB connection options
  mongo: {
    uri: 'mongodb://localhost/fullstack-dev'
 },

  // Postgres connection options
  postgres: {
          uri: process.env.POSTGRES_URL ||
         'postgres://user:pass@localhost:5432/testDB'
  },
  database: 'testDB',
  username: 'postgres',
  password: 'postgres',
  seedDB: true
  };

屏幕 pgadmin DB screenshot index.html screenshot

【问题讨论】:

    标签: javascript angularjs postgresql angular-fullstack


    【解决方案1】:

    我已经弄清楚了,这是 index.html 代码中的错误/错误

    <div class="container">
       <div class="row">
        <div class="col-lg-12">
          <h1 class="page-header">Features:</h1>
    
           <ul class="nav nav-tabs nav-stacked col-md-4 col-lg-4 col-sm-6" ng-repeat="thing in awesomeThings">
    
        <li><a href="#" tooltip="{{thing.info}}">{{thing.name}}</a></li>
      </ul>
    </div>
    

    但是从数据库中选择是

    SELECT "id", "title", "info", "active", "createdAt", "updatedAt" FROM "Things" AS "Thing";
    

    没有thing.name字段,所以在ng-repeat中没有任何显示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-08
      • 2011-08-09
      • 2021-01-21
      相关资源
      最近更新 更多