我有一个表单,其中包含一个mat-chip和一个按钮(模板驱动),如果没有验证mat-chip,我想禁用提交按钮,
demo.component.html
class Demo{
public separatorKeysCodes = [ENTER, COMMA];
public list = [];
add(event): void {
if (event.value) {
this.list.push(event.value);
}
if (event.input) {
event.input.value = '';
}
}
remove(data: any): void {
if (this.list.indexOf(data) >= 0) {
this.list.splice(this.list.indexOf(data), 1);
}
}
}
在demo.component.ts中,我定义了在输入中添加和删除芯片的函数
function myFunction(){
var url = "https://spreadsheets.google.com/feeds/cells/1TtXe1JXKsxHKUWb3bqniHkLQB0Po1fSUqsiib2yMv90/1/public/values?alt=json";
try{
var sh = SpreadsheetApp.getActive().getSheetByName("Sheet1");
var response = UrlFetchApp.fetch(url)
var str = response.getContentText();
var data = JSON.parse(response);
var entry = data.feed.entry;
sh.getRange(1, 1).setValue(entry[0].content.$t);
sh.getRange(1, 2).setValue(entry[1].content.$t);
}catch(e){
Logger.log(e);
}
}