是否有可能用值迭代填充树枝数组?
{% for question in questions %}
{% set multipleChoiceArray = [] %}
{% for multipleChoice in question.multipleChoiceAnswers %}
{% set multipleChoiceArray = multipleChoiceArray|merge( multipleChoice.answerText ) %}
{% endfor %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)
问题出在这里 multipleChoiceArray|merge(multipleChoice.answerText)
当我尝试传递一个数组,例如使用key = loop.index之类的
{% set multipleChoiceArray = multipleChoiceArray|merge({"loop['index']":"multipleChoice['answerText']"}) %}
Run Code Online (Sandbox Code Playgroud)
它工作但数组包含字符串"["loop ['index']":"multipleChoice ['answerText']"]"
当我尝试传递变量,如:
{% set multipleChoiceArray = multipleChoiceArray|merge({loop.index:multipleChoice.answerText}) %}
Run Code Online (Sandbox Code Playgroud)
例外是:哈希键后面必须跟冒号(:).意外的标记"标点符号"的值"." ("标点符号"预期值":")
所以我无法将"multipleChoice.answerText"值"推"到"multipleChoiceArray"中
有什么提示可行吗?我只想收集所有可能的答案,然后检查答案是否在该阵列中并计算并显示
我在我的角度视图中选择我要添加所选功能:
<select ng-options="value for value in deutscheBankEvent.dates" ng-init="" ng-model="chosenA" class="chzn-select">
<option style="display:none" value="">Wählen Sie ein Datum</option>
</select><br/>
Run Code Online (Sandbox Code Playgroud)
我的控制器:当我在这里注入.chosen函数时,它会清除选项.
function Ctrl($scope,$http) {
$scope.text = '';
$scope.user = {name: '', last: '', location: ''};
$scope.value = 0;
$scope.sendForm = function (){
$http.post('/Submit/To/Url', $scope.data).success(function(data) {
alert('done!');
});
};
}
Run Code Online (Sandbox Code Playgroud)
我的页脚:
<g:javascript>
$(".chzn-select").chosen(); $(".chzn-select-deselect").chosen({allow_single_deselect:true});
jQuery(".adressen1_chzn-select").chosen();jQuery(".adressen0_chzn-select").chosen();
});
</g:javascript>
Run Code Online (Sandbox Code Playgroud)
我不知道,如何让所选择的工作.内部控制器它清除选项而不适用,其余部分没有任何区别.任何想法赞赏
这是骨干表格的代码.现在,我想呈现一个提交按钮来验证我的文本字段和内容,这是记录的,除了如何将提交按钮放入dom.随便投降,无论如何,在我看来这很难找到新手
(function($) {
var cities = {
'UK': ['London', 'Manchester', 'Brighton', 'Bristol'],
'USA': ['Washington DC', 'Los Angeles', 'Austin', 'New York']
};
//The form
var form1 = new Backbone.Form({
schema: {
country: { type: 'Select', options: ['UK', 'USA'] },
city: { type: 'Select', options: cities.UK },
message: { type: 'Text'}
}
}).render();
form1.on('country:change', function(form1, countryEditor) {
var country = countryEditor.getValue(),
newOptions = cities[country];
form1.fields.city.editor.setOptions(newOptions);
});
//Add it to the page
$('body').append(form1.el);
})(jQuery);
Run Code Online (Sandbox Code Playgroud) 我将内联图像添加到localhost上的邮件中:
inline 'footerImage', 'image/jpg', new File('./web-app/images/mailAssets/suchebottomre.gif').readBytes()
Run Code Online (Sandbox Code Playgroud)
哪个工作正常.当我部署到我的测试环境时,我收到此错误:
Class
java.io.FileNotFoundException
Message
cannot use ./web-app/images/mailAssets/alert_header_pre.png as an attachment as it does not exist
Run Code Online (Sandbox Code Playgroud)
用这个日志:
Line | Method
->> 331 | inline in grails.plugin.mail.MailMessageBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 20 | doCall in de.docinsider.web.NotifierService$_contactUser_closure1
| 39 | sendMail . in grails.plugin.mail.MailService …Run Code Online (Sandbox Code Playgroud) javascript ×2
angularjs ×1
arrays ×1
backbone.js ×1
debugging ×1
grails ×1
html ×1
html-email ×1
localhost ×1
php ×1
symfony ×1
twig ×1