Template not found- using angularjs ngCart to build shopping cart for ecommerce

两盒软妹~` 提交于 2020-01-17 06:02:07

问题


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!


回答1:


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>



回答2:


In ngcart folder there is a template folder name, you copy it to the project folder, because it contains the html he complained lack.



来源:https://stackoverflow.com/questions/38690105/template-not-found-using-angularjs-ngcart-to-build-shopping-cart-for-ecommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!