av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

angular.js - items.query is not a function這是怎么回事

瀏覽:208日期:2024-10-05 18:26:13

問(wèn)題描述

<p ng-app='myApp'> <p ng-controller='firstcontroller'><h1>Shop!</h1><table> <tr ng-repeat='item in items'></tr> <td>{{item.title}}</td> <td>{{item.description}}</td> <td>{{item.price | currency}}</td> </tr></table> </p></p> <script>var app = angular.module('myApp', []);app.factory(’items’, function() { var items = {}; items.query = function() {return [{ title: ’Paint pots’, description: ’Pots full of paint’, price: 3.95}, { title: ’Polka dots’, description: ’Dots with polka’, price: 2.95}, { title: ’Pebbles’, description: ’Just little rocks’, price: 6.95}]; } return items;})app.controller(’firstcontroller’,[’$scope’,’items’,function($scope,items){ $scope.items=items.query();}])</script>

瀏覽可以正確運(yùn)行代碼,但是不顯示數(shù)據(jù)。只顯示出angular.js -  items.query is not a function這是怎么回事

<p ng-app='myApp'> <p ng-controller='firstcontroller'><h1>Shop!</h1>{{items}} </p></p>

代碼更改成這樣,可以顯示出數(shù)據(jù),說(shuō)明數(shù)據(jù)已經(jīng)綁定成功了,為什么使用這段代碼,無(wú)法顯示數(shù)據(jù)?

<table> <tr ng-repeat='item in items'></tr> <td>{{item.title}}</td> <td>{{item.description}}</td> <td>{{item.price | currency}}</td> </tr> </table>

初學(xué)Angular,如果,有哪里不正確,請(qǐng)各位指出。

問(wèn)題解答

回答1:

第一個(gè)tr后面多了一個(gè)/tr吧 這樣里面沒(méi)東西,所以已經(jīng)repeat了只是repeat出了一堆空

相關(guān)文章:
主站蜘蛛池模板: 亚洲一级精品 | 久久久久久网 | 日韩精品在线播放 | 国产精品麻豆免费版 | 色老板免费视频 | 日本特级黄色片 | 国产午夜三级一区二区三 | 求av网站 | 久久久一级片 | 日韩免费精品视频 | 免费在线看a | 国产a久久麻豆入口 | 久久国产一区二区三区 | 黄免费视频 | 欧美成人精品欧美一级乱黄 | 精品视频在线播放 | 夜夜操夜夜爽 | 亚洲aaaaaa | 日韩av网站在线观看 | 欧美成人一区二区三区片免费 | 中文字幕在线观看日本 | 日韩毛片免费 | 9l蝌蚪porny中文自拍 | 国产手机在线视频 | 成人av一区二区三区在线观看 | 久久综合国产 | 黄色三级网 | 中文字幕综合 | 一区二区三区国产视频 | 二区三区视频 | 九九久久精品视频 | 欧美成人午夜 | 精品免费在线 | 青青草在线免费视频 | 国产高潮在线观看 | 91免费版看片 | 国内精品国产成人国产三级 | 涩涩的视频 | 自拍偷在线精品自拍偷无码专区 | 黑人精品一区二区 | 日本丰满肉感bbwbbwbbw |