本文介绍了找不到模板-使用angularjs ngCart构建电子商务购物车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个有角度的Web应用程序,并试图合并ngCart.我使用bower install ngcart --save安装了它,将bower文件合并到了index.html文件中,并将其作为依赖项注入到应用程序中.当我尝试使用<ngcart-addtocart>指令(仅将ngcart-addtocart标记合并到视图文件中)时,出现以下错误-Error: [$compile:tpload] Failed to load template: template/ngCart/addtocart.html (HTTP status: 404 Not Found)

I am building an angular web app and am trying to incorporate ngCart. I installed it using bower install ngcart --save, incorporated the bower file in my index.html file and injected it as a dependency into the app. When I try to use the <ngcart-addtocart> directive (only incorporating the ngcart-addtocart tag in the view file) I get the following error - Error: [$compile:tpload] Failed to load template: template/ngCart/addtocart.html (HTTP status: 404 Not Found)

我怀疑这是我想念的简单事情.谢谢!

I suspect it is something simple I am missing. Thank you!

推荐答案

bower安装文件下载到的ngCart目录中查找.

look in the ngCart directory that bower installed downloaded the files to.

app/public/libraries/ngCart/template/
└── ngCart
    ├── addtocart.html
    ├── cart.html
    ├── checkout.html
    └── summary.html

然后在指令中将其写入模板位置.

then in the directive write in the template location.

<ngcart-summary template-url="/libraries/ngCart/template/ngCart/summary.html"></ngcart-summary>

这篇关于找不到模板-使用angularjs ngCart构建电子商务购物车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 11:07