ng-include 不包括模板
ng-include not including template
我正在学习 Angular 上的代码学校教程。我正在尝试使用 ng-include 包含一个模板。我有以下代码:
<h3 ng-include="'product-title.html'"></h3>
和我的product-title.html
{{product.name}}
<em class="pull-right">{{product.price | currency}}</em>
当我检查它显示的元素时 <!-- ngInclude: 'product-title.html' -->
问题。我需要成为 运行 网络服务器才能运行吗?
是的,您需要从服务器 运行 您的应用程序。模板通过 AJAX 调用加载,这些调用需要来自网络服务器。
对于 运行 临时静态文件服务器,您有几个轻量级选项,例如:
- 节点的
simple-server
(https://github.com/balupton/simple-server)
- python的
python -m SimpleHTTPServer
我正在学习 Angular 上的代码学校教程。我正在尝试使用 ng-include 包含一个模板。我有以下代码:
<h3 ng-include="'product-title.html'"></h3>
和我的product-title.html
{{product.name}}
<em class="pull-right">{{product.price | currency}}</em>
当我检查它显示的元素时 <!-- ngInclude: 'product-title.html' -->
问题。我需要成为 运行 网络服务器才能运行吗?
是的,您需要从服务器 运行 您的应用程序。模板通过 AJAX 调用加载,这些调用需要来自网络服务器。
对于 运行 临时静态文件服务器,您有几个轻量级选项,例如:
- 节点的
simple-server
(https://github.com/balupton/simple-server) - python的
python -m SimpleHTTPServer