问题
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