我创建了一个angular-cli
包含AppComponent的项目,如下所示:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app works!';
}
Run Code Online (Sandbox Code Playgroud)
和app.component.html一样
<h1>
Good Morning, {{title}}
</h1>
Run Code Online (Sandbox Code Playgroud)
因此,当我使用ng build
它生成它时会生成一些像这样的文件./dist/main.bundle.js,其中包含一些代码,如下所示 -
/* 586 */
/***/ function(module, exports) {
module.exports = "<h1>\n Good Morning, {{title}}\n</h1>\n"
/***/ },
/* 587 */
Run Code Online (Sandbox Code Playgroud)
这意味着,在构建时,编译器/ bundle-er正在读取html文件并将它们连接到生成的js文件中.
但在我的情况下,html也是动态的,内容驱动的是服务器端.可以说,我的模板文件不是html,而是app.component.jsp,并且完全驻留在一些不同的服务器或文件夹上.
此JSP文件有时会返回<h1>Good Morning, {{title}}</h1>
,有时还<h1>Good Afternoon, {{title}}</h1>
取决于当前的服务器时间.
如何实现这一功能?
我的理解是,我需要定义某种加载器函数说: loadDynamicTemplate(template_url) …
我试图多次添加多个类别来交替嵌入[]和依赖[].但我总是在网站上看到JavaScript中的依赖项解析错误.
另外,如何在多值条目中指定类别的顺序,如embed []?有没有什么办法可以控制网站启动时加载的JavaScript源的顺序?
最近,我花了一些时间试图更好地理解AEM技术堆栈.有这么多件,似乎很容易混淆.我一直在寻找AEM上的JCR实现.我一直在读它使用CRX.但是,我知道它也使用Apache Jackrabbit.它是否同时使用?使用这两种实现背后的逻辑是什么?何时何地使用?
一个更好的问题可能是CRX和Jackrabbit之间的关系是什么?
我试图从我的localhost:4502端口将数据发布到API.当我尝试使用POSTMAN将数据发布到此API时,通过提供基本授权密钥将数据添加到后端.我试图在Ajax Jquery调用中实现这一点,但得到一个CORS错误.第一次在jquery我试图发布数据,请在这里帮助,我可以添加.我有基本授权的API密钥,因为用户名和密码可以留空.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#Save").click(function(){
var person = new Object();
person.Name = $('#Name').val();
person.EmailAddress = $('#EmailAddress').val();
person.CustomFields = [0];
person.CustomFields[0].Key = "[Country]";
person.CustomFields[0].Value = $('#Country').val();;
$.ajax({
url: 'https://api.createsend.com/api/v3.1/subscribers/7c7a6087b0e450ad72b38be83098e271.json',
type: 'POST',
dataType: 'json',
data:person,
success: function(data,textStatus,xhr){
console.log(data);
},
error: function(xhr,textStatus,errorThrown){
console.log('Error Something');
},
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic OTdlMjVmNWJiMTdjNzI2MzVjOGU3NjlhOTI3ZTA3M2Q5MWZmMTA3ZDM2YTZkOWE5Og==");
}
});
});
});
</script>
Run Code Online (Sandbox Code Playgroud) 我想看看Adobe CQ5 CMS系统.有人知道我是否可以将它下载到我的开发者计算机上?我在网站上找不到链接.
我知道Adobe提供CRX作为开源 - 但我的兴趣在于CQ5 cms.
我正在尝试在编辑时在组件对话框上设置默认选中复选框.以下是该领域的属性:
jcr:primaryType: widget
checked: true (boolean) *Documentation says this determines default checked status
type: checkbox (string) *read this as a fix to making checkbox selections stick
xtype: selection (string)
name: ./foo (string)
fieldValue: true (string)
Run Code Online (Sandbox Code Playgroud) 在使用Java 1.7在Windows上启动Sling时,我收到以下错误消息(见下文).我正在使用Sling 6(http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6-standalone.jar).知道什么可能是错的吗?
上次我尝试在Mac OSX上使用相同的Sling版本并且它工作得很好.
Failed to Start OSGi framework
org.osgi.framework.BundleException: Uncaught Instantiation Issue:
java.lang.ArrayIndexOutOfBoundsException: -1
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:245)
at
org.apache.sling.launchpad.base.app.MainDelegate$1.<init>(MainDelegate.java:159)
at
org.apache.sling.launchpad.base.app.MainDelegate.start(MainDelegate.java:159)
at org.apache.sling.launchpad.app.Main.startSling(Main.java:244)
at org.apache.sling.launchpad.app.Main.<init>(Main.java:107)
at org.apache.sling.launchpad.app.Main.main(Main.java:56)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at
org.apache.felix.framework.BundleImpl.getCurrentModule(BundleImpl.java:1046)
at
org.apache.felix.framework.BundleImpl.getSymbolicName(BundleImpl.java:863)
at
org.apache.sling.launchpad.base.impl.SlingFelix.getSymbolicName(SlingFelix.java:32)
at org.apache.felix.framework.Felix.toString(Felix.java:1012)
at org.apache.felix.framework.Logger.doLog(Logger.java:128)
at org.apache.felix.framework.Logger._log(Logger.java:181)
at org.apache.felix.framework.Logger.log(Logger.java:114)
at
org.apache.felix.framework.ExtensionManager.<init>(ExtensionManager.java:201)
at org.apache.felix.framework.Felix.<init>(Felix.java:374)
at
org.apache.sling.launchpad.base.impl.SlingFelix.<init>(SlingFelix.java:39)
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:235)
Run Code Online (Sandbox Code Playgroud) 是什么区别:data-sly-use
,data-sly-resource
,data-sly-include
,和data-sly-template
?我正在阅读文档Sightly
AEM
,我非常困惑.
据我所知:
data-sly-use
用于添加js/java
要使用doc呈现的文件data-sly-resource
用于注入组件data-sly-include
用于包含其他html文件(?***?)并且,数据狡猾模板令人困惑,如:
<div data-sly-use.nav="navigation.js">${nav.foo}</div>
<section data-sly-include="path/to/template.html"></section>
<template data-sly-template.one>blah</template>
<div data-sly-call="${one}"></div>
Run Code Online (Sandbox Code Playgroud) 我正试图在Sightly中实现递归算法解决河内塔问题.我知道这种方法可能没有很多明显的实际应用,我将其视为一个难题.我最终得到这样的东西:
<sly data-sly-template.step="${@ n, src, aux, dst}" data-sly-unwrap>
<sly data-sly-test="${n > 0}" data-sly-unwrap>
<sly data-sly-call="${step @ n = (n-1), src = src, aux = dst, dst = aux}" data-sly-unwrap/>
${src} -> ${dst}<br/>
<sly data-sly-call="${step @ n = (n-1), src = aux, aux = src, dst = dst}" data-sly-unwrap/>
</sly>
</sly>
<sly data-sly-call="${step @ n = 3, src = 'A', aux = 'B', dst = 'C'}" data-sly-unwrap/>
Run Code Online (Sandbox Code Playgroud)
但是,它没有编译,因为Sightly不支持算术运算符-
.我不需要从3到0计数,我们可能会采用相反的方式,因为这里的方向并不重要.我只需要一些具有以下功能的计数器:
我想过用字符串.空字符串为零,'x'为1,'xx'为2,依此类推.我们可以检查字符串是否等于数字(n == 'xxxx'
).我们甚至可以使用Sightly string formatter来增加它:
${'x{0}' …
Run Code Online (Sandbox Code Playgroud) 我想向AEM写一些数据,下面的代码在AEM 6.0中适用于我,但在AEM 6.1中没有,总是抛出一个Login Exception,如下所示:
" 获取服务的CRX用户时出现登录异常:'writeService'.org.apache.sling.api.resource.LoginException:无法派生bundle group.tti.commons-service [395]和子服务writeService的用户名 "
OSGI配置:
我班上的代码:
import javax.jcr.Session;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
....
@Reference
private ResourceResolverFactory factory;
private ResourceResolver resourceResolverWriter;
private static Session adminSession;
...
...
Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "writeService");
try {
resourceResolverWriter = factory.getServiceResourceResolver(param);
adminSession = resourceResolverWriter.adaptTo(Session.class);
...
} catch (LoginException e) {
...
}
Run Code Online (Sandbox Code Playgroud)
我在AEM 6.1上遗漏了什么?
aem ×10
sightly ×2
sling ×2
adobe ×1
ajax ×1
angular ×1
angular-cli ×1
cors ×1
crx ×1
jackrabbit ×1
jquery ×1
math ×1
recursion ×1
typescript ×1