我正在尝试通过范围变量传递模板的URL.范围不会更改,因此模板不需要基于它进行更新,但目前范围变量始终未定义.
<div cell-item template="{{col.CellTemplate}}"></div>
Run Code Online (Sandbox Code Playgroud)
理想情况下,指令将是:
.directive("cellItem", ["$compile", '$http', '$templateCache', '$parse', function ($compile, $http, $templateCache, $parse) {
return {
scope: {
template: '@template'
},
templateUrl: template // or {{template}} - either way
};
}])
Run Code Online (Sandbox Code Playgroud)
但这不起作用.我已经尝试了很多不同的排列来完成相同的概念,这似乎是最接近的,但它仍然不起作用.
.directive("cellItem", ["$compile", '$http', '$templateCache', '$parse', function ($compile, $http, $templateCache, $parse) {
return {
scope: {
template: '@template'
},
link: function (scope, element, attrs) {
var templateUrl = $parse(attrs.template)(scope);
$http.get(templateUrl, { cache: $templateCache }).success(function (tplContent) {
element.replaceWith($compile(tplContent)(scope));
});
}
};
}])
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用ng-include,但在编译之前也没有评估范围变量.CellTemplate值来自数据库调用,因此在评估之前完全未知.任何有关此工作的建议将不胜感激!
编辑:我使用角度1.0.8,我无法升级到更新的版本.
我遇到过这种情况多次,找不到任何全面的东西.我想知道GWT的所有有效消耗DOM事件的完整列表.
NativeEvent 的GWT文档说:
public final java.lang.String getType()
Gets the enumerated type of this event.
Returns:
the event's enumerated type
Run Code Online (Sandbox Code Playgroud)
这个枚举在哪里?它确实存在吗?使用的(我发现的)实际代码明确地说这些事件总是使用字符串:"click","contextmenu","mouseup","dblclick"等等(等等覆盖了这么多的迷路......)
我想实现在CellTable ALA既双击和右键单击的单元这篇文章.我正在通过超级("点击","contextmenu","mouseup","dblclick"); 在我的AbstractCell扩展的构造函数中.然后我覆盖了onBrowserEvent:
@Override
public void onBrowserEvent(Context context, Element parent, ImageProperties<T> value,
NativeEvent event, ValueUpdater<ImageProperties<T>> valueUpdater) {
if (event.getButton() == NativeEvent.BUTTON_RIGHT) {
event.stopPropagation();
event.preventDefault();
eventBus.fireEvent(new RightClickEvent<Context>(context, event));
} else {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我遇到了两个问题.一,默认的contextMenu仍然显示(通过我的自定义) - 更不用说它甚至不使用DOM事件类型.一个不同的问题,我如何检查它是否是一个双击事件?我发现很难相信它实际上是一组任意的字符串......
提前致谢!约翰
我在 64 位 Windows 7 机器上有 Eclipse Helios 64 位和 64 位 java。当我启动 Eclipse 时,可能需要长达 30 分钟的时间才会出现工作区提示符。一旦出现工作区提示,一切都很好并且以正常速度运行。有时它会在短短 30 秒内启动并出现提示。无论我的计算机上正在运行或未运行其他程序,启动速度都会有所不同。
我有 4 GB 内存,我的 ini 文件如下。我尝试更改所有值,以及What are the best JVM settings for Eclipse? 的变体?。-clean 或 -refresh 选项均适用于选择工作区后,因此没有帮助,与删除元数据相同。在花费时间最长的时候,Eclipse 将仅使用 20 mb 的 ram 来打开,并且每秒仅获得约 16 kb。在加载项目的情况下运行时,它通常使用 940 MB 的 RAM。工作区提示出现在 256 mb 左右——启动器烫发大小。
-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-showsplash
org.eclipse.platform
-vm
C:/Java/Java/jdk1.6.0_25/jre/bin/server/jvm.dll
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-vmargs
-Dosgi.requiredJava
Version=1.5
-Dosgi.requiredJavaVersion=1.5
-Xms728m
-Xmx728m
Run Code Online (Sandbox Code Playgroud)
如果有人有任何想法或也经历过这一点,我将不胜感激。
我有两个项目.项目A将项目B作为依赖于它的pom.
<dependency>
<groupId>my.package.abc</groupId>
<artifactId>abc-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
项目B的pom:
<groupId>my.package.abc</groupId>
<artifactId>abc-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用Maven构建项目A时(通过eclipse使用参数"clean install -X"),我得到了编译错误:
[ERROR] ...\src\main\java\my\package\abc\client\Myclass.java:[3,37] error: package my.package.abc.common.client does not exist
Run Code Online (Sandbox Code Playgroud)
我从包含来自Project B的每个包中得到包*不存在错误.我检查了本地Maven仓库,并且jar存在并且在jar内部编译的文件存在.根据调试输出,在开始编译项目A时,项目B已成功添加到类路径中.
[DEBUG] Classpath:
...
[DEBUG] ...\.m2\repository\my\package\abc\abc-common\0.0.1-SNAPSHOT\abc-common-0.0.1-SNAPSHOT.jar
Run Code Online (Sandbox Code Playgroud)
因此,如果Maven正在查找项目B,并且项目B确实拥有它应该具有的所有类,为什么它在编译阶段无法找到任何这些类?
编辑:项目A上"clean install -X"的总输出太大,所以这是一个更大但仍然删节的版本.
[INFO] Deleting directory ..\workspace\abc-bci-web\target\classes\my\package
[INFO] Deleting directory ..\workspace\abc-bci-web\target\classes\my
[INFO] Deleting directory ..\workspace\abc-bci-web\target\classes\gov
[INFO] Deleting directory ..\workspace\abc-bci-web\target\classes
[INFO] Deleting directory ..\workspace\abc-bci-web\target
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ abc-bci-web ---
[DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3:
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-project:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-profile:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-core:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6:compile
[DEBUG] org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile
[DEBUG] org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile …Run Code Online (Sandbox Code Playgroud) 我是第一次设置Karma和量角器测试。按照John Papa的样式指南,单元测试文件与它们正在测试的文件一起,因此,例如:login.controller.js, login.controller.spec.js
但是,如果要添加量角器测试文件,则希望将其命名为login.spec.js。(全部用于登录模块)
命名的标准惯例是什么,以区分哪些测试文件是Karma单元测试和哪些是量角器e2e测试?