- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
官方教程来自这里: https://docs.angularjs.org/guide/directive
我从“创建指令”的子标题“模板扩展指令”中复制了官方代码。示例 1 运行良好(该示例中只有 script.js
和 index.html
),我的浏览器呈现了所需的结果。示例 2 是示例 1 的简单扩展,将指令文件中的“template”行替换为“templateUrl”行,并添加 my-customer.html
文件作为模板。但是,这对我不起作用。
复制的代码如下。所有文件都放在同一个文件夹中:
index3.html:
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example12-production</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"> </script>
<script src="script3.js"></script>
</head>
<body ng-app="docsTemplateUrlDirective">
<div ng-controller="Controller">
<div my-customer></div>
</div>
</body>
</html>
script3.js:
angular.module('docsTemplateUrlDirective', [])
.controller('Controller', ['$scope', function($scope) {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
return {
templateUrl: 'my-customer.html'
};
});
my-customer.html:
姓名:{{customer.name}} 地址:{{customer.address}}
为什么在浏览器中打开 index3.html
时出现空白页面?
最佳答案
通过在开发人员工具打开时禁用缓存来修复此问题(在 Chrome 的 js 控制台首选项中选择的选项)。代码是正确的。由于缓存的原因,它无法正确呈现。
关于javascript - AngularJs 指令 : Copied code verbatim from official tutorial and it doesn't work. 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31824367/
这可能看起来像一个简单而基本的问题。 我已经研究 r 几个月了,似乎找不到我正在寻找的函数。我什至不知道如何搜索它......出于搜索字符串的想法。 我知道有一个函数可以获取变量的定义而不是其内容。我
要转义还是逐字逐句,这是我的问题。 我需要在 C# 中以编程方式向 (Zebra QLn220) 打印机发送几个命令,具体而言: ! U1 setvar "power.dtr_power_off" "
知道 Java 没有像 C# 中那样的逐字字符串 (@),在代码中使用它时有没有办法保持字符串的格式?我有一个 sql 代码,我必须在代码中使用,但为了可读性我必须以某种格式保存它,我可以在 C# 中
有没有办法在 Pandoc markdown 中设置内联逐字片段(`...`)的默认颜色?例如,文档中的所有逐字记录都是红色而不是黑色? 我知道,我能做到,例如 Normal text `verbat
我试图通过引入一些节省时间的方法使 Latex 可用,但我在定义完全随机终止环境的新命令时遇到了麻烦。 这个有效: \newcommand{\bcv}{\ensuremath{\begin{small
我有一个 @ViewScoped带有 List 的 bean 包含纯 HTML。我想遍历这个列表并输出纯 html: #{html} 上面的代码片段运行良好,但是当页面刷新时,bean cos
我今天遇到了一个有趣的问题,我的测试在构建机器上一直失败,而即使它们在我的机器上工作得很好,即使使用相同的配置。当我在故障转储中查看 Assert.AreEqual 输出的差异时,我看不出有什么不同。
我有包含很多角度标签的模板。所以我将 {{ verbatim }} 放在 html 顶部,将 {{ endverbatim }} 放在 html 底部。 现在,在模板之间的某个地方,我需要检查一下,我
我需要一个别名来标记命令行代码,设置在黑色背景和白色文本上,如下使用: @cmd C:\temp>echo Hello, world! Hello, world! C:\temp> @endcmd 普
我希望这不是一个太晦涩的问题 - 我正在将 Algolia 搜索平台集成到我的一个项目中,以便能够无缝且轻松地进行搜索 yadda yadda。本质上,我正在寻找 Algolia 的 #hit-tem
我一直在关注 Apple 的 SwiftUI tutorials .在此过程中,我经常将 Text 对象与以下初始化程序一起使用: /// Creates an instance that displ
我将此发布到 PrimeFaces 用户论坛,但我认为他们太忙而无暇查看,所以我想我会在这里尝试。 我有服务器端字符串,里面有标记,所以当我想要它呈现时,我这样做:
我正在为我的公司制作介绍性的 R 指南。我正在做一个 R 帮助功能的小演示(速记) ?mean 这是在一个 knitr 块中: >= ?mean @ 输出: `?`(mean) 我希望它在我输入时输出
我有以下页面: 当我单击“gameSelector”按钮时,事件顺序如下:1.调用gameBean.get
我试图让 django 和 Vue 一起工作,即使它们共享相同的 {{ X }} 模板语法。 我知道从 django 1.5 开始我们可以使用 {% verbatim %} 标签。所以我想我可以像往常
官方教程来自这里: https://docs.angularjs.org/guide/directive 我从“创建指令”的子标题“模板扩展指令”中复制了官方代码。示例 1 运行良好(该示例中只有 s
在我的 app.yaml 文件中我有: - name: django version: "1.5" 我假设的意思是,使用 Django 1.5。 1.5 包括 verbatim标签,但是当我尝试
我正在编写正则表达式以在每个标记结束后删除换行符,例如模板字符串的“%}\n”。但当内容位于 {% verbatim %}content{% endverbatim %} 标签之间时,它不应删除,也不
我是一名优秀的程序员,十分优秀!