我使用材质2(角度5)切换了此按钮组
<div class="col-md-4">
<label>Days of Week</label>
<mat-button-toggle-group multiple formControlName="days_service" #group="matButtonToggleGroup" >
<mat-button-toggle [value]="days.value" *ngFor='let days of days_service'>
{{ days.alias }}
</mat-button-toggle>
</mat-button-toggle-group>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的按钮组
但是,我想将其更改为
我正在使用 mustache js 来渲染带有来自 API 的数据的模板并且效果很好,但我需要在一段时间后更新(重新渲染)相同的模板。就我而言,我在模板中有一个列表,如下所示:
模板.html
<div id="template">
{{#list}}
<span>{{firstName}} {{lastName}} - {{phone}}</span>
{{/list}}
</div>
Run Code Online (Sandbox Code Playgroud)
索引.js
$(document).ready(function(){
$.ajax(
//some ajax here
).done(function(response){
loadTemplate(response);
});
});
function loadTemplate(data){
var template = $("#template").html();
Mustache.parse(template);
var render = Mustache.to_html(template, data);
$("#template").empty().html(render);
};
Run Code Online (Sandbox Code Playgroud)
但是用户可以在此列表中添加更多元素,之后我需要更新 mustache 模板。我尝试调用 Ajax(在列表中添加新值的响应),然后再次调用 loadTemplate 函数但不起作用,列表不会使用新值更改(更新)。
我有反应形式的这个输入(材料 2)。而且我知道在此输入上放置时间掩码 (hh:mm) 的更好方法。或者我怎样才能为此建立一个指令?
<div class="col-md-2 hours">
<label for="floating-placeholder">Horário</label>
<div>
<input class="col-md-5 end" matInput placeholder="hh:mm" value="" name="end" minlength="4" maxlength="4" formControlName="start">
às
<input class="col-md-5 end" matInput placeholder="hh:mm" value="" name="end" formControlName="end">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)