Node.js Sequelize无法读取nulll的属性

时间:2018-04-29 17:57:01

标签: node.js express sequelize.js

这是错误的 TypeError:C:\ users \ gaffer \ desktop \ 6th Semester \ GafferCart \ views \ admin \ add_product.ejs:22

执行(默认):SELECT count(*)AS count FROM Products AS Product; 执行(默认):SELECT idtitleslugdesccategorypriceimages FROM {{ 1}} AS Products LIMIT 1; 执行(默认):SELECT Productidtitle FROM slug AS Categories LIMIT 1;

Category

>

无法读取属性' forEach'为null

    20|         <label for="">Category</label>

   21|         <select name="category" class="form-control">

 >> 22|             <% categories.forEach(function(cat){ %>

    23|                 <option value="<%= cat.slug %>"><%= cat.title %
</option>
    24|             <% }); %>
    25|         </select

1 个答案:

答案 0 :(得分:0)

您的categories对象为null,请控制该对象。