我正试图让选择框从使用Ang-repeat和AngularJS 1.1.5的预填充选项开始.相反,选择始终从未选择任何内容开始.它也有一个空选项,我不想要.我认为没有被选中的副作用.
我可以使用ng-options而不是ng-repeat来使用它,但我想在这种情况下使用ng-repeat.虽然我的缩小示例没有显示,但我也想设置每个选项的title属性,据我所知,使用ng-options无法做到这一点.
我不认为这与常见的AngularJs范围/原型继承问题有关.至少我在Batarang检查时没有看到任何明显的东西.此外,当您使用UI选择选项中的选项时,模型会更新正确.
这是HTML:
<body ng-app ng-controller="AppCtrl">
<div>
Operator is: {{filterCondition.operator}}
</div>
<select ng-model="filterCondition.operator">
<option
ng-repeat="operator in operators"
value="{{operator.value}}"
>
{{operator.displayName}}
</option>
</select>
</body>
Run Code Online (Sandbox Code Playgroud)
和JavaScript:
function AppCtrl($scope) {
$scope.filterCondition={
operator: 'eq'
}
$scope.operators = [
{value: 'eq', displayName: 'equals'},
{value: 'neq', displayName: 'not equal'}
]
}
Run Code Online (Sandbox Code Playgroud)
我想在JAXB中自定义日期的编组.这是这个已被问到的问题的变体.我想我会使用XMLAdapter,因为这个答案问题指明了.
但我不能这样做,就是这样,因为我要去周围的其他方法,从.XSD生成JAXB豆 - 因为它们生成的代码,我不能添加注释JAXB的豆.
我试过调用Marshaller.setAdapter(),但没有运气.
final Marshaller marshaller = getJaxbContext().createMarshaller();
marshaller.setSchema(kniSchema);
marshaller.setAdapter(new DateAdapter());
...
private static class DateAdapter extends XmlAdapter<String, XMLGregorianCalendar> {
@Override
public String marshal(XMLGregorianCalendar v) throws Exception {
return "hello"; //Just a test to see if it's working
}
@Override
public XMLGregorianCalendar unmarshal(String v) throws Exception {
return null; // Don't care about this for now
}
}
Run Code Online (Sandbox Code Playgroud)
我生成的JAXB bean的相关部分如下所示:
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar activeSince;
Run Code Online (Sandbox Code Playgroud)
当我这样做时,默认日期/ XMLGregorianCalendar编组发生了什么.就好像我没有做到这一切.
任何帮助表示赞赏.
谢谢,
查尔斯
我有一个使用Jersey/JAXB的Maven 2 RESTful应用程序.我从模式文件生成JAXB bean,模式文件位于我的资源目录中,例如src/main/resources/foo.xsd.
我想在生成的Maven站点中为我的项目包含foo.xsd文件,以便客户端在编写RESTful调用时可以看到XML模式.
如何在网站中包含foo.xsd?
我可以在src/main/site/...中获得该文件的副本,然后更新我的site.xml以指向它(或者有一个内容指向它的.apt),但我不喜欢因为我还在调整foo.xsd,并且不想记得每次更新它时都要复制它.这只是不好的做法.
我还尝试了一个.apt文件,它有一个指向foo.xsd的链接,它被复制到target/classes目录.这有效,直到我做一个站点:部署,因为它只复制目标/站点目录.
谢谢,
查尔斯
我们正在将应用从Play 1.2.7迁移到Play 2.3.2.
因为我们之前已将大部分Play 1.2.7应用程序从Backbone迁移到AngularJS,所以我们在1.2.7中最终得到了两个这样的静态资产目录:
/public -- contains Backbone scripts/templates
/platform/app -- contains AngularJS scripts/templates
Run Code Online (Sandbox Code Playgroud)
我试图在不破坏1.2.7代码的情况下并行进行迁移,所以我有类似的东西,所以我可以在/ app中重写Java控制器,并使用现有的JavaScript/HTML资产:
~/play1/app
~/play1/public
~/play1/platform/app
Run Code Online (Sandbox Code Playgroud)
和
~/play2/app
~/play2/public (symlink to ../../play1/public)
~/play2/platform (symlink to ../../play1/platform)
Run Code Online (Sandbox Code Playgroud)
当我执行激活器运行时,即使我有一个路由,也无法访问/ play2/platform中的文件.调查一下,这些文件都没有被复制到〜/ play2/target/public中,所以controller.Assets找不到它们.Play/SBT中有没有办法做到这一点?
我假设我可以以某种方式让脚本在我为构建分发时做副本(我需要研究一下),但我希望这只能用于交互式开发.
这可能是补救措施,但我是Play 2.x,Scala和SBT的新手,所以我还没弄清楚.
谢谢,
查尔斯