如何input通过button在移动设备上按原生键盘返回来模糊?
例如 :
<input type="text" #search>
this.search.blur() //-- unfocus and hide keyboard
Run Code Online (Sandbox Code Playgroud) 收到错误“无法解析主页的所有参数:([object Object], ?, [object Object], [object Object])” 。我正在尝试使用 angularfire 访问我的数据库 - 用户在登录时通过电子邮件发送 toastcontroller 消息。函数名称:“IonViewWillLoad()”
所有项目: https: //github.com/AndriusdevLa/test
那是我的主页:
import { Component } from '@angular/core';
import { NavController, ModalController } from 'ionic-angular';
import { DetailPage } from '../detail/detail';
import { ToastController } from 'toast-controller';
import { AngularFireAuth } from "angularfire2/auth";
import { User } from '../../app/modals/user';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
//public shouldReorder = false;
user = {} as User;
constructor(private aFAuth: AngularFireAuth,
private toastCtrl …Run Code Online (Sandbox Code Playgroud) 如果我的数组没有某些值或某些值在 html 中未定义,我想这样做,只是不要尝试从数组中获取它。
空数组:[{0:未定义}]
全阵列:
[
{0: "Name"},
{1: "img.src"},
{2: name: string, family: string, age: number}
]
Run Code Online (Sandbox Code Playgroud)
0: "Name" , 1: "img.src" 2 {name: string, family: string; 年龄:数}
我的尝试不起作用:
<div *ngFor="let fam of familyArray" class="grid-item">
<button ion-button>
<img *ngIf="fam[1] != undefined && fam[1] != null " class="selectImg" src="{{fam[1]}}" alt="">
</button>
<span *ngIf="fam[2].name != undefined && family[2].age != undefined && family[2].age != null && family[2].name != null " class="image-text">{{fam[2].name}}, {{family[2].age}}m.</span>
<p *ngIf="fam[2].family != undefined && fam[2].family != null " class="family-status">{{fam[2].family}}</p> …Run Code Online (Sandbox Code Playgroud) 我有一个功能女巫从文件中获取 html 内容作为字符串。之后我把它作为一个 html 对象。我可以在我的控制台中清楚地看到它可以工作。如何将它从服务传递到 div 元素?
导航.service.ts:
html: string;
public getZipFileContent(urlPath:string, pathInZip:string, ) {
getFileContentFromRemoteZip(urlPath, pathInZip, (content) => {
console.log(content);
let html = content;
let htmlObject = document.createElement('div');
htmlObject.innerHTML = html;
console.log(htmlObject);
this.html = html; // it's a string
this.html = htmlObject // error : can't asign string as HTMLdivElement
});
}
}
Run Code Online (Sandbox Code Playgroud)
通过在我的组件中添加{{navSrv.html}}我现在得到了什么:
我想得到什么:
Console.log 来自:console.log(htmlObject);
如何获取 htmlObject 并将其用作变量?
例如,如果我有两个相等的索引数组:
A [
{name: Jhon}
{name: Jacob}
{name: Lukas}
]
B [
{fr: Prince} //fr, en, it is language, Prince is LastName
{en: Breed}
{it: Lasontos}
]
Run Code Online (Sandbox Code Playgroud)
如何将其合并为一个所以它看起来像这样:
A [
{name: Jhon, lastname: Prince, country: fr }
{name: Jacob, lastname: Breed, country: en}
{name: Lukas, lastname: Lasontos, country: it}
]
Run Code Online (Sandbox Code Playgroud)